Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-4014

Investigate into corner cases: Wrong timezone calculation in DateFieldFactory

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.4.9
    • Fix Version/s: 5.4.11, 5.5.1
    • Component/s: forms
    • Labels:
    • Release notes required:
      Yes
    • Sprint:
      Saigon 75, Saigon 77, Saigon 78
    • Story Points:
      8
    • Magnolia Release:
      5.4.11, 5.5.1

      Description

      We should investigate into time zone corner cases as switching from winter to summer time and CET vs CUT time calculations:

      From the support ticket:

      Nr1:

      if one is entering a date for the winter time in a date (time) control, the time is stored incorrect (-1 hour) in jcr.
      for example:
      date '2016-10-30 12:00' will be saved as '2016-10-30T11:00:00.000+01:00'
      another example:
      entering date (without time) '2016-10-31' is stored as '2016-10-30T23:00:00.000+01:00'

      the problem is when displaying the previously set date using freemarker some_date?string('dd.MM.yyyy'):
      the output is '30.10.2016' instead of '31.10.2016'.
      this change apparently caused by 5.4.7, prior to this version it was printed correctly.

      you can reproduce it using the travel demo:

      edit a tour in the tours app
      set a date for wintertime 2016-10-31 & save
      edit /tours/templates/components/tourDetail.ftl to display the tour date using freemarker $

      Unknown macro: {tour.date?string('dd.MM.yyyy')}

      edit the TourDetailModel as well, currently it's not returning the date
      the output will be '30.10.2016' (-1 hour & -1 day)

      Nr2:

      Yes it's right that the date will be strored in iso time format with offset but it's not correct, if I'm entering time 12:00 CET in the dialog and in jcr the date is stored 11:00 CET. Although server and browser uses same timezone.
      If the browser uses a timezone with daylight saving time the magnolia timezone handling is broken.

      And then it's dependent to summer and winter time which date/time I'll see in the date field of an dialog.
      Example:
      Today (in summer time) I'm entering a date in winter time ('2016-10-31') and then I will open this entry in the same dialog on the 31th of october the date in the date field will switch to '2016-10-30'.
      It cannot be right.

      IMHO the problem is magnolia only uses offsets and ignores the timezone.
      Browser and Server using CET. The stored date is winter time (offset +1) and the browser uses summer time (offset +2). There is the difference of one hour. But what happens if I open the date in winter time? Browser offset +1 and stored date offset +1. Now there is no difference and that's why I see different times in date fields.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mgeljic Mikaël Geljić
              Reporter:
              cringele Christian Ringele
              Votes:
              8 Vote for this issue
              Watchers:
              16 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4d
                  4d
                  Remaining:
                  Time Spent - 2.5d Remaining Estimate - 1.5d
                  1.5d
                  Logged:
                  Time Spent - 2.5d Remaining Estimate - 1.5d
                  2.5d