root/trunk/activesupport/lib/active_support/json/encoders/date.rb
| Revision 9203, 316 bytes (checked in by rick, 5 months ago) |
|---|
| Line | |
|---|---|
| 1 | class Date |
| 2 | # Returns a JSON string representing the date. |
| 3 | # |
| 4 | # ==== Example: |
| 5 | # Date.new(2005,2,1).to_json |
| 6 | # # => "2005/02/01" |
| 7 | def to_json(options = nil) |
| 8 | if ActiveSupport.use_standard_json_time_format |
| 9 | %("#{strftime("%Y-%m-%d")}") |
| 10 | else |
| 11 | %("#{strftime("%Y/%m/%d")}") |
| 12 | end |
| 13 | end |
| 14 | end |
Note: See TracBrowser for help on using the browser.