Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

DatePicker MM/dd/yy #6625

Open
sreekanthjonna opened this issue Aug 30, 2017 · 4 comments
Open

DatePicker MM/dd/yy #6625

sreekanthjonna opened this issue Aug 30, 2017 · 4 comments

Comments

@sreekanthjonna
Copy link

Hi,

I am using DatePicker to pick the date it's working fine when we are select from the date picker (Sun Aug 20 2016 00:00:00 GMT-0500 (Central Daylight Time). But when we manually enter date as 08/20/16 it is taking as Sun Aug 20 1916 00:00:00 GMT-0500 (Central Daylight Time) so it is adding default to "19" when we manually enter 16 as year. can some one pls help..

Thanks
sree

@C-Merrill
Copy link

Can you provide steps to reproduce? I'm looking at the DatePicker now and it appears to be working as expected.

@hongthach12
Copy link

me too,
with format is 'MM/dd/yy'

pick 01/01/1940 => input will be display 01/01/40
but real value is 01/01/2040

@C-Merrill
Copy link

@hongthach12 your output is expected output from what I understand about the intended functionality of the module with that format (it's difficult to say because that format is inherently relying on the system to make assumptions about the century).
To preface, my understanding is that you are inputting 01/01/40 hoping for that to be recognized as 01/01/1940, but the system is actually representing it as 01/01/2040. If it's the other way around, I think that's an issue. The way that format is interpreted appears to be (I haven't read the docs) a rolling window of about 49 years in the past and 50 years in the future from today's date. So, a 2-digit year of 67 would translate to 1967, but 66 would translate to 2066. I might be wrong about the exact numbers as I am not looking at it at the moment, but I believe that is the concept. On that model, your output is coming out as expected and if you need it to be different, I would suggest using a 4-digit year format.
As for the OP's issue, that is not in line with the expected behavior, though I was not able to reproduce his example.

@hongthach12
Copy link

@C-Merrill, if using a 4-digit year format is ok.
but have issue with 2-digit year format.
i using Datepicker Popup, and i pick 01/01/1940 from popup (not input directly).
i print out (or debug) that model
=> value is 01/01/2040

code:

<input type="text" id="dateOfServiceFrom" ng-click="vm.popup.open()" class="form-control" is-open="vm.popup.opened" ng-model="vm.dateOfServiceFrom" placeholder="From" uib-datepicker-popup="'MM/dd/yy'"> {{ vm.params.ClaimSearch.dateOfServiceFrom }}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants