diff options
Diffstat (limited to 'activesupport/lib/active_support/json/encoders')
3 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/json/encoders/date.rb b/activesupport/lib/active_support/json/encoders/date.rb new file mode 100644 index 0000000000..ee1a472f3f --- /dev/null +++ b/activesupport/lib/active_support/json/encoders/date.rb @@ -0,0 +1,5 @@ +class Date + def to_json #:nodoc: + %("#{strftime("%m/%d/%Y")}") + end +end diff --git a/activesupport/lib/active_support/json/encoders/date_time.rb b/activesupport/lib/active_support/json/encoders/date_time.rb new file mode 100644 index 0000000000..28cb18977d --- /dev/null +++ b/activesupport/lib/active_support/json/encoders/date_time.rb @@ -0,0 +1,5 @@ +class DateTime + def to_json #:nodoc: + %("#{strftime("%m/%d/%Y %H:%M:%S %Z")}") + end +end diff --git a/activesupport/lib/active_support/json/encoders/time.rb b/activesupport/lib/active_support/json/encoders/time.rb new file mode 100644 index 0000000000..080e9392f1 --- /dev/null +++ b/activesupport/lib/active_support/json/encoders/time.rb @@ -0,0 +1,5 @@ +class Time + def to_json #:nodoc: + %("#{strftime("%m/%d/%Y %H:%M:%S %Z")}") + end +end |