Bug: set day
maximepvrt opened this issue · comments
If we use this example :
<input type="text" datetime="dd.MM.yyyy" ng-model="myDate" datetime-separator=",.-/">
and if the current month don't have 31 days, it's impossible to set 31 :-)
@eight04 you saw ?
I don't understand what the bug is. You like to allow users to select a date which doesn't exist?
No I want only valid dates. In France we start by the day and we can know if it is invalid date only if we know the month and the year also for the month of February. In the library if the month is not yet entered, it takes the current month, I feel.
<input type="text" datetime="dd.MM.yyyy" ng-model="myDate" datetime-separator=",.-/">
With this example it's impossible this month to create 31/07/2017, a valid date :-) @eight04
I got it. Here is the plunker:
https://plnkr.co/edit/mruEvHcYth5YxTmPAgXp?p=preview
- Hit "clear" button.
- Text becomes
(date).(month).(year)
. - Focus on the date part and type "31".
- Text becomes
01.(month).(year)
.
We can fix it by automatically increasing month when the date is overflowed. However it would be a breaking change when the month is already filled:
- Current behavior:
(date).06.2017
-> fill in "31" ->01.07.2017
- After the fix:
(date).06.2017
-> fill in "31" ->31.07.2017
If we want to avoid this change, we have to check if the month part is empty to decide how we should handle overflowed date.
Yes I think is good !
31.(month).(year) -> we can add only a month with 31 days ? else automatically set the next month with 31 days.
It would be nice to add an option who don't automatically fix date and set input $invalid ? @eight04
You think proposing a fix ? If yes in how long about? thanks @eight04
I'm still working on other stuff these days (alright maybe these weeks).
There is no easy fix for this issue.
- We have to make custom-input pass the parser object to
add
andrestore
function so they are able to reference the month node and check if the month is set. - Even better, we should change the structure of the nodes (or extend
.getNodes
API) to make them accessible from their name so we don't have to loop through the node array to find the month node for each call ofadd
/restore
.
I think I'll be able to finish this before August. Maybe in the next week, I'll start working on this.
Fixed in v5.1.3