{"action":"created","issue":{"url":"https://api.github.com/repos/dateutil/dateutil/issues/434","repository_url":"https://api.github.com/repos/dateutil/dateutil","labels_url":"https://api.github.com/repos/dateutil/dateutil/issues/434/labels{/name}","comments_url":"https://api.github.com/repos/dateutil/dateutil/issues/434/comments","events_url":"https://api.github.com/repos/dateutil/dateutil/issues/434/events","html_url":"https://github.com/dateutil/dateutil/issues/434","id":247392652,"number":434,"title":"_naive_is_dst results in exception for negative epoch dates on windows","user":{"login":"Prinz23","id":3189456,"avatar_url":"https://avatars3.githubusercontent.com/u/3189456?v=4","gravatar_id":"","url":"https://api.github.com/users/Prinz23","html_url":"https://github.com/Prinz23","followers_url":"https://api.github.com/users/Prinz23/followers","following_url":"https://api.github.com/users/Prinz23/following{/other_user}","gists_url":"https://api.github.com/users/Prinz23/gists{/gist_id}","starred_url":"https://api.github.com/users/Prinz23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Prinz23/subscriptions","organizations_url":"https://api.github.com/users/Prinz23/orgs","repos_url":"https://api.github.com/users/Prinz23/repos","events_url":"https://api.github.com/users/Prinz23/events{/privacy}","received_events_url":"https://api.github.com/users/Prinz23/received_events","type":"User","site_admin":false},"labels":[{"id":149492525,"url":"https://api.github.com/repos/dateutil/dateutil/labels/bug","name":"bug","color":"fc2929","default":true},{"id":177050120,"url":"https://api.github.com/repos/dateutil/dateutil/labels/time%20zones","name":"time zones","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/dateutil/dateutil/milestones/4","html_url":"https://github.com/dateutil/dateutil/milestone/4","labels_url":"https://api.github.com/repos/dateutil/dateutil/milestones/4/labels","id":1299444,"number":4,"title":"Bugfix release","description":"This is a tracking milestone for an unspecified bugfix release. It indicates that a given issue or PR can be included on the next point release.","creator":{"login":"pganssle","id":1377457,"avatar_url":"https://avatars0.githubusercontent.com/u/1377457?v=4","gravatar_id":"","url":"https://api.github.com/users/pganssle","html_url":"https://github.com/pganssle","followers_url":"https://api.github.com/users/pganssle/followers","following_url":"https://api.github.com/users/pganssle/following{/other_user}","gists_url":"https://api.github.com/users/pganssle/gists{/gist_id}","starred_url":"https://api.github.com/users/pganssle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pganssle/subscriptions","organizations_url":"https://api.github.com/users/pganssle/orgs","repos_url":"https://api.github.com/users/pganssle/repos","events_url":"https://api.github.com/users/pganssle/events{/privacy}","received_events_url":"https://api.github.com/users/pganssle/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":5,"state":"open","created_at":"2015-09-10T14:22:04Z","updated_at":"2017-08-02T16:11:45Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2017-08-02T13:40:02Z","updated_at":"2017-08-03T11:40:03Z","closed_at":null,"body":"```python\r\nimport datetime\r\nfrom dateutil import tz\r\n\r\ndt = datetime.datetime.combine(datetime.date(1965, 11, 1), datetime.time(14, 0)).replace(tzinfo=tz.tzlocal())\r\n\r\ndt.utcoffset()\r\n```\r\nthis results on windows in exception:\r\n```\r\nTraceback (most recent call last):\r\n  File \"C:/git-tests/dateutil-test/test.py\", line 6, in <module>\r\n    dt.utcoffset()\r\n  File \"C:/git-tests/dateutil-test\\dateutil\\tz\\tz.py\", line 179, in utcoffset\r\n    if self._isdst(dt):\r\n  File \"C:/git-tests/dateutil-test\\dateutil\\tz\\tz.py\", line 248, in _isdst\r\n    dstval = self._naive_is_dst(dt)\r\n  File \"C:/git-tests/dateutil-test\\dateutil\\tz\\tz.py\", line 217, in _naive_is_dst\r\n    return time.localtime(timestamp + time.timezone).tm_isdst\r\nValueError: (22, 'Invalid argument')\r\n```\r\nreason is that **time.localtime()** doesn't support negative values on windows."},"comment":{"url":"https://api.github.com/repos/dateutil/dateutil/issues/comments/319945104","html_url":"https://github.com/dateutil/dateutil/issues/434#issuecomment-319945104","issue_url":"https://api.github.com/repos/dateutil/dateutil/issues/434","id":319945104,"user":{"login":"Prinz23","id":3189456,"avatar_url":"https://avatars3.githubusercontent.com/u/3189456?v=4","gravatar_id":"","url":"https://api.github.com/users/Prinz23","html_url":"https://github.com/Prinz23","followers_url":"https://api.github.com/users/Prinz23/followers","following_url":"https://api.github.com/users/Prinz23/following{/other_user}","gists_url":"https://api.github.com/users/Prinz23/gists{/gist_id}","starred_url":"https://api.github.com/users/Prinz23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Prinz23/subscriptions","organizations_url":"https://api.github.com/users/Prinz23/orgs","repos_url":"https://api.github.com/users/Prinz23/repos","events_url":"https://api.github.com/users/Prinz23/events{/privacy}","received_events_url":"https://api.github.com/users/Prinz23/received_events","type":"User","site_admin":false},"created_at":"2017-08-03T11:40:03Z","updated_at":"2017-08-03T11:40:03Z","body":"Python3 gives the same UnicodeEncodeError. The registry info would not help anyways since windows timezone info starts at 1970-1-1.\r\n\r\nCurrently as workaround i use the `get_localzone` from `tzlocal` lib to get the real zoneinfo timezone name (windows has it's own names) and using this I'm loading the zoneinfo in dateutil.\r\n\r\nIdeally dateutil would itself have the mapping (windows timezone names to zoneinfo names) function included and would load the the info from zoneinfo itself.\r\n\r\n```python\r\nimport datetime\r\nfrom dateutil import tz\r\nfrom tzlocal import get_localzone\r\n\r\ndt = datetime.datetime.combine(datetime.date(1965, 11, 1), datetime.time(14, 0)).replace(tzinfo=tz.gettz(get_localzone().zone))\r\n\r\ndt.utcoffset()\r\n```\r\n\r\nthis works. \r\n\r\nBut is double work since `get_localzone` already returns the zoneinfo file, but it's own. So this would work too:\r\n\r\n```python\r\ndt = datetime.datetime.combine(datetime.date(1965, 11, 1), datetime.time(14, 0)).replace(tzinfo=get_localzone())\r\n```\r\n\r\nSo would have to maintain both lib zoneinfo data. That is the reason i use the name returned from it to load the zoneinfo from dateutil."}}
{"actor":{"display_login":"Prinz23"}}