diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2014-01-26 21:22:23 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2014-01-26 21:25:54 +0000 |
commit | dd339bb0adc3bb1f0c376c4352f769ae2ab02b62 (patch) | |
tree | 84d91b89bcc7ea9861edd5a3ce8f57772f34fff4 /activesupport/lib/active_support | |
parent | c0965004486f2ea5a9656ba718a3377c9614f97d (diff) | |
download | rails-dd339bb0adc3bb1f0c376c4352f769ae2ab02b62.tar.gz rails-dd339bb0adc3bb1f0c376c4352f769ae2ab02b62.tar.bz2 rails-dd339bb0adc3bb1f0c376c4352f769ae2ab02b62.zip |
Make ActiveSupport::TimeWithZone#xmlschema consistent
Both Time#xmlschema and DateTime#xmlschema can accept nil values for the
fraction_digits parameter. This commit makes this so for TimeWithZone
values as well.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 626438c9e4..d459af1778 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -132,8 +132,8 @@ module ActiveSupport end def xmlschema(fraction_digits = 0) - fraction = if fraction_digits > 0 - (".%06i" % time.usec)[0, fraction_digits + 1] + fraction = if fraction_digits.to_i > 0 + (".%06i" % time.usec)[0, fraction_digits.to_i + 1] end "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{fraction}#{formatted_offset(true, 'Z')}" |