Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1758

Date returned as datetime in json

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.4.6
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      mongoid (2.4.5)

      I have field :date, :type => Date in my model.

      >> transaction.date.class
      Date < Object
      >> transaction.date
      Sat, 21 May 2011
      >> transaction.date.to_json
      "\"2011-05-21\""

      but

      >> transaction.to_json
      ......"date\":\"2011-05-21T00:00:00Z\"....

      in addition:

      >> transaction[:date].class
      Time < Object
      >> transaction[:date]
      2011-05-21 00:00:00 UTC

      Why??? And how to change it?

            Assignee:
            durran Durran Jordan
            Reporter:
            iabdulin iabdulin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: