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

Accept formatted strings in Date/Time/DateTime.demongoize

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 8.0.1
    • Affects Version/s: None
    • Component/s: Attributes
    • None
    • Fully Compatible

      Time.demongoize could attempt to demongoize string input in various formats, for example:

       

      Time.demongoize("2022-04-20T17:20:04.75-07:00")
        #=> undefined method `getlocal' for "2022-04-20T17:20:04.75-07:00":String (NoMethodError) 

      The `#demongoize` method is expected to work for a variety of input types, not just Time, as the user may have stored strings in their database previously then changed the field type.

       

      This suggestion was originally reported in this PR: https://github.com/mongodb/mongoid/pull/5245 by Github user @alilland{}

      When this ticket is implemented, the following needs to be considered:

      Which time formats to parse
      Time zones

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            shields@tablecheck.com Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: