« Previous | Next » 

Revision c7df9c8c

IDc7df9c8c14d78ba99d30eb90f1d49ebc04735224
Parent 19dcf1ed

Added by Tom Clegg 5 months ago

6347: Use RFC3339Nano to render timestamps loaded from serialized fields.

Psych (YAML) serializes timestamps as ISO8601-with-space-separators,
and safe_load deserializes them to Time even with
whitelist_classes=[].

Psych.dump(Time.now.utc)
=> "--- 2017-02-22 21:33:22.845133778 Z\n...\n"

Psych.safe_load('2017-02-22 21:33:22.845133778 Z').class
=> Time

Psych.safe_load('2017-02-31 21:33:22.845133778 Z').class
=> String

Before:

Psych.safe_load('2017-02-22 21:33:22.845133778 Z').as_json
=> "2017-02-22T21:33:22Z"

After:

Psych.safe_load('2017-02-22 21:33:22.845133778 Z').as_json
=> "2017-02-22T21:33:22.845133778Z"

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences