Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateToString ignore daylight saving #829

Open
ivanteoh opened this issue Aug 16, 2017 · 0 comments
Open

DateToString ignore daylight saving #829

ivanteoh opened this issue Aug 16, 2017 · 0 comments

Comments

@ivanteoh
Copy link
Member

ivanteoh commented Aug 16, 2017

When I run the unit test for the master branch, the unit test for DateToString fail.

Failure in test test_DateToString (Products.CMFPlomino.tests.test_plominoutils.PlominoUtilsTest)
Traceback (most recent call last):
  File "/Users/ivan/code/buildout.python/parts/opt/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/Users/ivan/code/work/PlominoWorkflow/src/Products/CMFPlomino/tests/test_plominoutils.py", line 29, in test_DateToString
    self.assertEqual(utils.DateToString(date), '2013-10-07')
  File "/Users/ivan/code/buildout.python/parts/opt/lib/python2.7/unittest/case.py", line 513, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/Users/ivan/code/buildout.python/parts/opt/lib/python2.7/unittest/case.py", line 506, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: '2013-10-06' != '2013-10-07'

I run the test from Sydney. Sydney got daylight saving.

Standard Time: Sydney Time Time = GMT+10
Daylight Saving: Sydney Time Time = GMT+11

and toZone(TIMEZONE) seem to ignore the daylight saving when TIMEZONE = os.environ.get('TZ', None) is None and DateToString function is using it.

>>> date.toZone(TIMEZONE)
DateTime('2013/10/06 23:00:00 GMT+10')
>>> date
DateTime('2013/10/07 00:00:00 GMT+11')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant