{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/27597","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/27597/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/27597/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/27597/events","html_url":"https://github.com/dart-lang/sdk/issues/27597","id":183323970,"number":27597,"title":"DateTime add(new Duration(days:1)) does not handle daylight switch","user":{"login":"jorgjanke","id":168846,"avatar_url":"https://avatars.githubusercontent.com/u/168846?v=3","gravatar_id":"","url":"https://api.github.com/users/jorgjanke","html_url":"https://github.com/jorgjanke","followers_url":"https://api.github.com/users/jorgjanke/followers","following_url":"https://api.github.com/users/jorgjanke/following{/other_user}","gists_url":"https://api.github.com/users/jorgjanke/gists{/gist_id}","starred_url":"https://api.github.com/users/jorgjanke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorgjanke/subscriptions","organizations_url":"https://api.github.com/users/jorgjanke/orgs","repos_url":"https://api.github.com/users/jorgjanke/repos","events_url":"https://api.github.com/users/jorgjanke/events{/privacy}","received_events_url":"https://api.github.com/users/jorgjanke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-17T04:38:10Z","updated_at":"2016-10-17T05:31:39Z","closed_at":null,"body":"Duration \"days: 1\" is converted to 24h\r\nThis causes issues when switching from/to daylight/standard time: \r\n\r\n```\r\nvoid main() {\r\n  DateTime theDay = new DateTime(2016,10,30);\r\n\tDateTime dateLast = new DateTime(2016,12,3);\r\n  Duration ONE_DAY = new Duration(days: 1);\r\n  while (!theDay.isAfter(dateLast)) {\r\n    print(theDay);\r\n    theDay = theDay.add(ONE_DAY);\r\n  }\r\n}\r\n```\r\noutput:\r\n2016-11-04 00:00:00.000\r\n2016-11-05 00:00:00.000\r\n2016-11-06 00:00:00.000\r\n**2016-11-06 23:00:00.000**\r\n2016-11-07 23:00:00.000\r\n2016-11-08 23:00:00.000\r\n\r\nSolution: Duration must store Days - I suggest also storing months, ... to properly convert + maintain ISO Duration 1M1DT"},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/254116077","html_url":"https://github.com/dart-lang/sdk/issues/27597#issuecomment-254116077","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/27597","id":254116077,"user":{"login":"lrhn","id":4865287,"avatar_url":"https://avatars.githubusercontent.com/u/4865287?v=3","gravatar_id":"","url":"https://api.github.com/users/lrhn","html_url":"https://github.com/lrhn","followers_url":"https://api.github.com/users/lrhn/followers","following_url":"https://api.github.com/users/lrhn/following{/other_user}","gists_url":"https://api.github.com/users/lrhn/gists{/gist_id}","starred_url":"https://api.github.com/users/lrhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrhn/subscriptions","organizations_url":"https://api.github.com/users/lrhn/orgs","repos_url":"https://api.github.com/users/lrhn/repos","events_url":"https://api.github.com/users/lrhn/events{/privacy}","received_events_url":"https://api.github.com/users/lrhn/received_events","type":"User","site_admin":false},"created_at":"2016-10-17T05:31:39Z","updated_at":"2016-10-17T05:31:39Z","body":"That would be a significiant change to `Duration`. It's also difficult to actually compute the difference between two `DateTime` objects in days and months. Days is doable, months requires some guessing as to which is correct. How many days are there from January 28 to March 1? (I'm sure we can do *something*, but it's less clear that it won't be the wrong thing in some cases).\r\n\r\nMy guess is that working with *dates* and *time zones* at the same time is a mistake. It would be better to have a `Date` class that only works with dates and doesn't include `Time`. Then `DateTime` can be used mainly as a timestamp, which it does amiably."}}
{"actor":{"display_login":"lrhn"}}