recurr icon indicating copy to clipboard operation
recurr copied to clipboard

TextTransformerTest fails west side of GMT

Open gregor-tb opened this issue 7 years ago • 2 comments

Hi,

actually the last test does not pass here, because of timezone issues:

     'FREQ=YEARLY;BYMONTH=3;UNTIL=20121231T235959Z',
     'yearly on March 16 until December 31, 2012'

For me in Europe/Berlin it results in

    -'yearly on March 16 until December 31, 2012'
    +'yearly on March 16 until January 1, 2013'

what makes sense, I think the code is correct, UTC midnight is 1:59 on january 1st on local. For each location east side of GMT the test passes (including America).

The test should force UTC timezone/starttime and maybe write another test for +/- timezones?

Best regards Gregor

gregor-tb avatar Nov 30 '17 09:11 gregor-tb

OK forcing UTC will not help here, because the issue is in the translation files:

return date('j. ', $params['date']) . $months[date('n', $params['date']) - 1] . date(', Y', $params['date']);

this uses default timezone.

gregor-tb avatar Nov 30 '17 09:11 gregor-tb

Hi, same here in France (Europe/Paris) - I think it is because of the "UNTIL" datetime value >here< : the "Z" at the end seems to actually specify/force the timezone to UTC, then to adapt the entered until datetime to our timezone (+1 hour in wintertime, +2 in summertime for Europe/Paris). I tested with "+01" instead of the "Z", and without this "Z" - both passed the tests, and the second case seems to take the current timezone for the actually entered until value.

Same forced then adapted datetime in "UNTIL" occures >here<, but because it is in the middle of the year and the hour is not checked (by the way, is it possible in the transformed text ?), this test passes.

Best regards

EDIT : the test can also be easily fixed by adding the following to the phpunit.xml file > phpunit element :

    <php>
        <ini name="date.timezone" value="UTC" />
    </php>

raneomik avatar Feb 08 '19 14:02 raneomik