{"action":"created","issue":{"url":"https://api.github.com/repos/eternicode/bootstrap-datepicker/issues/1556","labels_url":"https://api.github.com/repos/eternicode/bootstrap-datepicker/issues/1556/labels{/name}","comments_url":"https://api.github.com/repos/eternicode/bootstrap-datepicker/issues/1556/comments","events_url":"https://api.github.com/repos/eternicode/bootstrap-datepicker/issues/1556/events","html_url":"https://github.com/eternicode/bootstrap-datepicker/pull/1556","id":104570048,"number":1556,"title":"Added better year detection","user":{"login":"dswitzer","id":900497,"avatar_url":"https://avatars.githubusercontent.com/u/900497?v=3","gravatar_id":"","url":"https://api.github.com/users/dswitzer","html_url":"https://github.com/dswitzer","followers_url":"https://api.github.com/users/dswitzer/followers","following_url":"https://api.github.com/users/dswitzer/following{/other_user}","gists_url":"https://api.github.com/users/dswitzer/gists{/gist_id}","starred_url":"https://api.github.com/users/dswitzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dswitzer/subscriptions","organizations_url":"https://api.github.com/users/dswitzer/orgs","repos_url":"https://api.github.com/users/dswitzer/repos","events_url":"https://api.github.com/users/dswitzer/events{/privacy}","received_events_url":"https://api.github.com/users/dswitzer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-09-02T20:59:13Z","updated_at":"2015-10-20T16:49:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/eternicode/bootstrap-datepicker/pulls/1556","html_url":"https://github.com/eternicode/bootstrap-datepicker/pull/1556","diff_url":"https://github.com/eternicode/bootstrap-datepicker/pull/1556.diff","patch_url":"https://github.com/eternicode/bootstrap-datepicker/pull/1556.patch"},"body":"I refactored the code to do better year detection. There are 2 changes:\r\n\r\n* When a user enters a 2 digit year, the code now does a better job of guessing intent. If the 2 digit year is more than 10 years in the future, it'll use the past century instead. So in the 2015, a value between 00-25 would assume the century is 2000. For 26-99, it'll assume the user meant 1900 (e.g. 1/31/10 = Jan 31, 2010, 1/31/26 = Jan 31, 1926). People don't generally enter future dates too far in advance, but it's very common to enter dates from 50+ years ago.\r\n* I changed the \"yyyy\" parse so that if the year is under 100, it assumes the user meant a 4 digit year. I can't think of a valid use case of when someone would really be entered Jan 1, 0015 as a date, but it's extremely common for users to enter a 2 digit year when a 4 digit year is asked for.\r\n\r\nHopefully you find this changes useful."},"comment":{"url":"https://api.github.com/repos/eternicode/bootstrap-datepicker/issues/comments/149630276","html_url":"https://github.com/eternicode/bootstrap-datepicker/pull/1556#issuecomment-149630276","issue_url":"https://api.github.com/repos/eternicode/bootstrap-datepicker/issues/1556","id":149630276,"user":{"login":"Azaret","id":1201743,"avatar_url":"https://avatars.githubusercontent.com/u/1201743?v=3","gravatar_id":"","url":"https://api.github.com/users/Azaret","html_url":"https://github.com/Azaret","followers_url":"https://api.github.com/users/Azaret/followers","following_url":"https://api.github.com/users/Azaret/following{/other_user}","gists_url":"https://api.github.com/users/Azaret/gists{/gist_id}","starred_url":"https://api.github.com/users/Azaret/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azaret/subscriptions","organizations_url":"https://api.github.com/users/Azaret/orgs","repos_url":"https://api.github.com/users/Azaret/repos","events_url":"https://api.github.com/users/Azaret/events{/privacy}","received_events_url":"https://api.github.com/users/Azaret/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T16:49:23Z","updated_at":"2015-10-20T16:49:23Z","body":"My argument here is not to fit one user case (historical stuff) but more like: As there is, and will be, several use cases where the expected output when typing 2 digits years will be different, then it should not try to assume what the user meant.\r\n\r\nIn my opinion the picker should be agnostic from assuming what the user meant. Because if we have something agnostic then all use cases will work. If you start to assume when the user meant, then you'll restrict the use cases.\r\n\r\nAlso you put the limit to your limit to know if the user meant 21's or 20's century at 10 years, but this is totally arbitrary (I kinda don't like arbitrary stuff). And there this some use case where this won't work, for example copyrights; For copyrights it should assume when the user type 20 that he meant 2020, even 2120. But I'll agree that this is a specific use case, but so it is to take this 10 years limit.\r\n\r\nAnd in the case the user really meant to enter a date under 100 for any reason, then like the core `Date` object you'll introduce the Y2K bug and won't let the user input those years, so at least it should be an optional feature.\r\n\r\nAt the end, it's just a personal belief that assuming is bad but I can understand it. Just it should be at least optional, we should be able to set any year."}}