Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-40383

dateFromParts does not overflow correctly if isoWeek smaller than 1

    XMLWordPrintable

Details

    • Minor Change
    • ALL
    • v4.2, v4.0, v3.6
    • Query 2019-05-06, Query 2019-05-20, Query 2019-06-03, Query 2019-06-17, Query 2019-07-01, Query 2019-07-15
    • 31

    Description

      When using dateFromParts with ISO8601 weeks, the date does not calculate correctly if the isoWeek parameter is less than 1.

      Some examples:

       'date'*:* { $dateFromParts: { isoWeekYear: 2019, isoWeek: 0 } } gives ** 2019-12-24
       
       'date'*:* { $dateFromParts: { isoWeekYear: 2019, isoWeek: -1 } } gives ** 2019-12-17
       
       'date'*:* { $dateFromParts: { isoWeekYear: 2019, isoWeek: -51 } } gives ** 2019-01-01
       
       'date'*:* { $dateFromParts: { isoWeekYear: 2019, isoWeek: -52 } } gives ** 2018-12-25
      

      Attachments

        1. SERVER-40383-master.patch
          21 kB
        2. SERVER-40383-v4.0.patch
          21 kB

        Issue Links

          Activity

            People

              justin.seyster@mongodb.com Justin Seyster
              SamTolmay Sam Tolmay [X]
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: