time and dates

An article by Gaspard Bucher
  1. action
  2. ajax
  3. API
    1. zafu
    2. query builder
    3. rubyless
    4. gold
    5. property
    6. versions
    7. remote
    8. zazen
    9. console
  4. classes
  5. common attributes
  6. conditions
  7. context
  8. dates
  9. display
  10. forms
  11. i18n
  12. meta
  13. SQLiss
  14. urls


We have changed the ‘to_json’ method in Time so that it’s fast and works automatically when parsing the string (no typecasting).

Without Property , Time.now.utc.to_json looks like this out of rails:

"Thu Feb 11 17:50:18 UTC 2010"

With rails you get:

"2010/02/11 17:50:18 +0000"

With Property , you will have:

{"data":"2010-02-11 17:50:18","json_class":"Time"}

Note that this is the only version where this is true:

t = Time.utc(2010,02,11,17,50,18)
t == JSON.parse(t.to_json)