{"action":"created","issue":{"url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6731","repository_url":"https://api.github.com/repos/OrchardCMS/Orchard","labels_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6731/labels{/name}","comments_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6731/comments","events_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6731/events","html_url":"https://github.com/OrchardCMS/Orchard/issues/6731","id":146746788,"number":6731,"title":"Huge issue with time-only DateTimeField and DST","user":{"login":"dpomt","id":1379660,"avatar_url":"https://avatars.githubusercontent.com/u/1379660?v=3","gravatar_id":"","url":"https://api.github.com/users/dpomt","html_url":"https://github.com/dpomt","followers_url":"https://api.github.com/users/dpomt/followers","following_url":"https://api.github.com/users/dpomt/following{/other_user}","gists_url":"https://api.github.com/users/dpomt/gists{/gist_id}","starred_url":"https://api.github.com/users/dpomt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpomt/subscriptions","organizations_url":"https://api.github.com/users/dpomt/orgs","repos_url":"https://api.github.com/users/dpomt/repos","events_url":"https://api.github.com/users/dpomt/events{/privacy}","received_events_url":"https://api.github.com/users/dpomt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"DanielStolt","id":3889090,"avatar_url":"https://avatars.githubusercontent.com/u/3889090?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielStolt","html_url":"https://github.com/DanielStolt","followers_url":"https://api.github.com/users/DanielStolt/followers","following_url":"https://api.github.com/users/DanielStolt/following{/other_user}","gists_url":"https://api.github.com/users/DanielStolt/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielStolt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielStolt/subscriptions","organizations_url":"https://api.github.com/users/DanielStolt/orgs","repos_url":"https://api.github.com/users/DanielStolt/repos","events_url":"https://api.github.com/users/DanielStolt/events{/privacy}","received_events_url":"https://api.github.com/users/DanielStolt/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/OrchardCMS/Orchard/milestones/35","html_url":"https://github.com/OrchardCMS/Orchard/milestones/Orchard%201.10.x","labels_url":"https://api.github.com/repos/OrchardCMS/Orchard/milestones/35/labels","id":1651831,"number":35,"title":"Orchard 1.10.x","description":"","creator":{"login":"sebastienros","id":1165805,"avatar_url":"https://avatars.githubusercontent.com/u/1165805?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastienros","html_url":"https://github.com/sebastienros","followers_url":"https://api.github.com/users/sebastienros/followers","following_url":"https://api.github.com/users/sebastienros/following{/other_user}","gists_url":"https://api.github.com/users/sebastienros/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastienros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastienros/subscriptions","organizations_url":"https://api.github.com/users/sebastienros/orgs","repos_url":"https://api.github.com/users/sebastienros/repos","events_url":"https://api.github.com/users/sebastienros/events{/privacy}","received_events_url":"https://api.github.com/users/sebastienros/received_events","type":"User","site_admin":false},"open_issues":491,"closed_issues":1,"state":"open","created_at":"2016-03-17T17:23:15Z","updated_at":"2016-04-15T16:29:38Z","due_on":"2016-09-01T07:00:00Z","closed_at":null},"comments":8,"created_at":"2016-04-07T21:28:24Z","updated_at":"2016-04-15T16:33:48Z","closed_at":null,"body":"Hi, \r\n\r\nI have a huge issue with time-only DateTimeField in a productive site running Orchard 1.9.x. \r\n\r\nThe issue is that time-only fields are always stored as UTC (converted from CurrenetTimeZone at moment of saving/publishing a content item) time but rendered as local time (at the moment of displaying the content item) and this depends if DST is active for moment of creation and/or displaying the field. \r\n\r\n**First for clarification:**\r\nCentral European Summer Time (CEST) = Central European Daylight Saving Time (CEDT= CET DST). CEDT = UTC + 2. \r\nCentral Summer Time (CEST) = Central European Daylight Saving Time (CEDT= CET DST). CET = UTC + 1. \r\n\r\n\r\n**Example:**\r\nAt my Event content type, I have one date-only field for the date and one time-only field for the time. I took this approach since it should be possible for an event to have no time. \r\nRegard the following 4 cases all dealing with creation of a time for a CET date - they differ only in creation date (whether CET or CEDT) and display date (whether CET or CEDT) \r\n\r\n**Case 1:** On November 2015 (CET) create an event with a date for May 2016 (CEDT). Set the time-only field to 10:00 a.m. Since creation is while CET it is stored as 09:00 a.m. (UTC=CET-1). \r\n**Case 1a:** Look at the item while CET, e. g. January 2016: time is displayed correctly, since CET = UTC+1 ==> 10:00 a.m. \r\n**Case 1b:** Look at the item while CEDT, e. g. May 2016: time is displayed incorrectly, since CEDT = UTC+2 ==> 11:00 a.m. \r\n\r\n**Case 2:** On April 2016 (CEDT) create an event with a date for May 2016 (CEDT). Set the time-only field to 10:00 a.m. Since creation is while CEDT it is stored as 08:00 a.m. (UTC=CEDT-2). \r\n**Case 2a:** Look at the item while CEDT, e. g. May 2016: time is displayed correctly, since CEDT = UTC+2 ==> 10:00 a.m. \r\n**Case 2b:** Look at the item while CET, e. g. January 2017: time is displayed incorrectly, since CET = UTC+1 ==> 09:00 a.m. \r\n\r\nI took a look at the implementation in DefaultDateLocalizationService:ConvertFromLocalizedString and DateTimeFieldDriver:Display/Editor. \r\nI think to fix the issue we need to add \"options.EnableTimeZoneConversion = false;\" for time-only fields in the DateTimeFieldDriver:Display and in the DateTimeFieldDriver:Editor methods. \r\n\r\nTotally there are two occurences where I applied added here disabling the time zone conversion: \r\nif (settings.Display == DateTimeFieldDisplays.TimeOnly) {\r\n                options.EnableCalendarConversion = false;\r\n                options.EnableTimeZoneConversion = false;\r\n                options.IgnoreDate = true\r\n} \r\n\r\nOf course with this fix all existing time-only field values stored in DB are also incorrect and need to be adapted.\r\n\r\nPlease give me feedback if this is a suitable fix or if there is any better way to fix it. \r\n\r\n\r\nThanks, \r\nDieter"},"comment":{"url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/comments/210533774","html_url":"https://github.com/OrchardCMS/Orchard/issues/6731#issuecomment-210533774","issue_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6731","id":210533774,"user":{"login":"sebastienros","id":1165805,"avatar_url":"https://avatars.githubusercontent.com/u/1165805?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastienros","html_url":"https://github.com/sebastienros","followers_url":"https://api.github.com/users/sebastienros/followers","following_url":"https://api.github.com/users/sebastienros/following{/other_user}","gists_url":"https://api.github.com/users/sebastienros/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastienros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastienros/subscriptions","organizations_url":"https://api.github.com/users/sebastienros/orgs","repos_url":"https://api.github.com/users/sebastienros/repos","events_url":"https://api.github.com/users/sebastienros/events{/privacy}","received_events_url":"https://api.github.com/users/sebastienros/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T16:33:48Z","updated_at":"2016-04-15T16:33:48Z","body":"https://github.com/OrchardCMS/Orchard/issues/6781"}}