Calendar minDate is mutating input value
See original GitHub issueBug Report
Hi, I am porting Fomantic Calendar to a Vue component and just noticed a bug. Setting minDate
(initially or after initialization) to a date that is later than the input value, it is mutating the input value as well.
Steps to reproduce
- set
minDate
to today - set the
value
to a day that is before thanminDate
(initially)
Expected result
If the initial value is 1 august 2020, and minDate
is 1 september 2020, input should show 1 august 2020, not 1 september 2020 which is minDate
. It is misleading to show minDate inside input as the input is showing another date than the calendar value holds.
Actual result
Calendar is setting minDate
as input value
Testcase
https://codepen.io/onelly/pen/YzqEPKd
Screenshot
Version
2.8.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
in daterangepicker how can i set minDate Dynamically?
I want to set minDate Dynamically to end date input based on start date. In short, I want to prevent a user from...
Read more >Populating Missing Dates with Complete and Fill Functions in ...
What this is going to do is to populate rows for all the combination of Date and Product column values. The Date values...
Read more >airDatepicker: Air Date Picker Input in shinyWidgets - Rdrr.io
By default value is taken from current localization, but if it passed here then it will have higher priority. minDate. The minimum allowed...
Read more >set minDate and maxDate using semantic-ui-calender-Vue.js
startTime.calendar({ type: 'time', minDate: minDate, maxDate: maxDate, onChange(date ... How can I set and get the value of an input component using Vue.js?...
Read more >Vue Calendar Component - PrimeFaces
To disable entering dates manually, set manualInput to false and to restrict selectable dates with the minDate and maxDate options. <Calendar v-model="value" : ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@elibolonur Yes, understood 🙂 . I just wanted to point out, that a change has to be done properly and might has more impact than it sounds.
@lubber-de Regarding to your message before; if we assume that a form field “always” will be filled I agree, by design, it makes sense. But if the form field may not be changed but is there as for the presentation, and if the user wants to update the date, then the minimum selectable date should be restricted only, not update the presenting currentValue. That is the scenario, and of course there is a validation layer both in frontend and backend.
And there is another side of it, porting it to vue and keeping all calendar setting properties in sync within vue component lifecycle/state and jQuery state. Suddenly calendar mutates the current value that leads us to an inconsistent vue/fomantic calendar component, which also is an anti pattern. Now, is it possible to accomplish what we are trying to do somehow inside the porting part? For sure yes, with a couple of “hacky” lines of code.
I mean, I understand that it is an issue to disable it and change the workflow. Keeping the current behaviour but giving an option to disable that minDate or maxDate is mutating the currentValue would make it easier, as this is going to be a common case with any modern JS framework where they have their own state management and trying to port fomantic calendar. Or maybe an event like
onAutoAdjust
to hook to the event or know when it is adjusting to prevent that.