{"action":"created","issue":{"url":"https://api.github.com/repos/andrewmcveigh/cljs-time/issues/133","repository_url":"https://api.github.com/repos/andrewmcveigh/cljs-time","labels_url":"https://api.github.com/repos/andrewmcveigh/cljs-time/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/andrewmcveigh/cljs-time/issues/133/comments","events_url":"https://api.github.com/repos/andrewmcveigh/cljs-time/issues/133/events","html_url":"https://github.com/andrewmcveigh/cljs-time/issues/133","id":389079534,"node_id":"MDU6SXNzdWUzODkwNzk1MzQ=","number":133,"title":"Calculating time intervals under daylight savings time?","user":{"login":"danielcompton","id":811954,"node_id":"MDQ6VXNlcjgxMTk1NA==","avatar_url":"https://avatars2.githubusercontent.com/u/811954?v=4","gravatar_id":"","url":"https://api.github.com/users/danielcompton","html_url":"https://github.com/danielcompton","followers_url":"https://api.github.com/users/danielcompton/followers","following_url":"https://api.github.com/users/danielcompton/following{/other_user}","gists_url":"https://api.github.com/users/danielcompton/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcompton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcompton/subscriptions","organizations_url":"https://api.github.com/users/danielcompton/orgs","repos_url":"https://api.github.com/users/danielcompton/repos","events_url":"https://api.github.com/users/danielcompton/events{/privacy}","received_events_url":"https://api.github.com/users/danielcompton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-09T23:48:44Z","updated_at":"2018-12-11T23:35:36Z","closed_at":null,"author_association":"COLLABORATOR","body":"In New Zealand, the following test will fail:\r\n\r\n```clj\r\n(let [date-start (format/parse-local-date yyyy-mm-dd \"2016-09-01\")\r\n          date-end   (format/parse-local-date yyyy-mm-dd \"2016-09-30\")]\r\n      (let [interval (time/interval date-start date-end)]\r\n        (is (= 29 (time/in-days interval))))\r\n```\r\n\r\n```\r\nChrome 71.0.3578 (Mac OS X 10.14.1) day8.apps-lib.cljstime-local-date-test local-date-interval-test FAILED\r\n\tFAIL in   (local-date-interval-test) (cljs/test.js:433:14)\r\n\texpected: (=\r\n\t            29\r\n\t            (time/in-days interval))\r\n\t  actual: (=\r\n\t            29\r\n\t            28)\r\n\t    diff: - 29\r\n\t          + 28\r\n```\r\n\r\nThe issue is that in 2016, New Zealand switched over to daylight savings time on Sunday 25th September. `(time/in-days)` on `Interval` bottoms out by calculating the millisecond difference between two dates. On Sunday 25th the clocks went forward an hour, meaning there was 'one less hour' in that day. This means that there is one hour less between the two local dates than there would ordinarily be at other times of the year.\r\n\r\nI wonder whether `in-days` on at least `goog.date.Date` should count the number of days between the dates, not counting the number of milliseconds between them?"},"comment":{"url":"https://api.github.com/repos/andrewmcveigh/cljs-time/issues/comments/446404104","html_url":"https://github.com/andrewmcveigh/cljs-time/issues/133#issuecomment-446404104","issue_url":"https://api.github.com/repos/andrewmcveigh/cljs-time/issues/133","id":446404104,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NjQwNDEwNA==","user":{"login":"danielcompton","id":811954,"node_id":"MDQ6VXNlcjgxMTk1NA==","avatar_url":"https://avatars2.githubusercontent.com/u/811954?v=4","gravatar_id":"","url":"https://api.github.com/users/danielcompton","html_url":"https://github.com/danielcompton","followers_url":"https://api.github.com/users/danielcompton/followers","following_url":"https://api.github.com/users/danielcompton/following{/other_user}","gists_url":"https://api.github.com/users/danielcompton/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcompton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcompton/subscriptions","organizations_url":"https://api.github.com/users/danielcompton/orgs","repos_url":"https://api.github.com/users/danielcompton/repos","events_url":"https://api.github.com/users/danielcompton/events{/privacy}","received_events_url":"https://api.github.com/users/danielcompton/received_events","type":"User","site_admin":false},"created_at":"2018-12-11T23:35:36Z","updated_at":"2018-12-11T23:35:36Z","author_association":"COLLABORATOR","body":"Thanks, that was helpful in pointing me towards this comment: https://github.com/andrewmcveigh/cljs-time/issues/22#issuecomment-208514810. I've been experimenting locally with making a UtcDate type where DateTime : UtcDateTime :: Date : UtcDate. It seems to provide a good foundation for dealing with local dates that have no time nor timezone."}}
{"actor":{"display_login":"danielcompton"}}