Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: set day #52

Closed
maximepvrt opened this issue Jun 27, 2017 · 8 comments
Closed

Bug: set day #52

maximepvrt opened this issue Jun 27, 2017 · 8 comments

Comments

@maximepvrt
Copy link

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 :-)

@maximepvrt
Copy link
Author

@eight04 you saw ?

@eight04
Copy link
Owner

eight04 commented Jun 29, 2017

I don't understand what the bug is. You like to allow users to select a date which doesn't exist?

@maximepvrt
Copy link
Author

maximepvrt commented Jun 29, 2017

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

@eight04
Copy link
Owner

eight04 commented Jun 30, 2017

I got it. Here is the plunker:
https://plnkr.co/edit/mruEvHcYth5YxTmPAgXp?p=preview

  1. Hit "clear" button.
  2. Text becomes (date).(month).(year).
  3. Focus on the date part and type "31".
  4. 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.

@maximepvrt
Copy link
Author

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

@maximepvrt
Copy link
Author

You think proposing a fix ? If yes in how long about? thanks @eight04

@eight04
Copy link
Owner

eight04 commented Jul 17, 2017

I'm still working on other stuff these days (alright maybe these weeks).

There is no easy fix for this issue.

  1. We have to make custom-input pass the parser object to add and restore function so they are able to reference the month node and check if the month is set.
  2. 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 of add/restore.

I think I'll be able to finish this before August. Maybe in the next week, I'll start working on this.

@eight04
Copy link
Owner

eight04 commented Jul 24, 2017

Fixed in v5.1.3

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

No branches or pull requests

2 participants