Allow creating UTCDateTime instances from string dates

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • PHP Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Whenever a string date is given, MongoDB\BSON\UTCDateTime instances need an intermediate DateTimeInterface instance to be created:

      new UTCDateTime(new DateTimeImmutable('2021-05-18T00:00:00.000Z'))
      

      It would be simpler if this could be done directly:

      new UTCDateTime('2021-05-18T00:00:00.000Z')
      

      Note that any string currently given to the constructor is parsed as a 64-bit number, so this may prove unfeasible. Ideally, the constructor would accept all formats accepted by DateTimeInterface implementations.

              Assignee:
              Unassigned
              Reporter:
              Andreas Braun
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:

                  Estimated:
                  Original Estimate - 2 days, 4 hours
                  2d 4h
                  Remaining:
                  Remaining Estimate - 2 days, 4 hours
                  2d 4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified