#7759 closed bug (notabug)
DateFormat without year (e.g. "d M") results in a corrupt datepicker
Reported by: | saskovic | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.datepicker | Version: | 1.8.16 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Setting:
$this.datepicker( "option", "dateFormat", 'd MM' ); $this.datepicker('setDate', new Date()); // Today is 3 October 2011
Result: (FAIL)
- 3 January 2011
- Datepicker is not clickable
Setting:
$this.datepicker( "option", "dateFormat", 'MM' ); $this.datepicker('setDate', new Date()); // Today is 3 October 2011
Result: (FAIL)
- October
- Datepicker is not clickable
Setting:
$this.datepicker( "option", "dateFormat", 'd MM y' ); $this.datepicker('setDate', new Date()); // Today is 3 October 2011
Result: (SUCCESS)
- 3 October 11
- Datepicker is clickable
Change History (10)
comment:1 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:3 Changed 11 years ago by
Sorry for the dupe.
I disagree with the resolution.
I was under the impression that dateFormat was to control the visible output format. Given that the user selects a date with year (regardless of what dateFormat is set to), I'd expect that dateFormat be applied to the selected date.
In additional, when dateFormat doesn't include the year, getDate returns a different value to what gets set in altField.
The user selects a full date, but the year is discarded, and there's no way to retrieve the correct date programmatically. This shouldn't be the case, regardless of whether you're choosing to output the year in dateFormat or not.
comment:4 Changed 11 years ago by
The text field is the canonical data source. You can't not have a year.
comment:7 Changed 11 years ago by
Sorry for the duplicate. But the number of duplicates show how important this issue is for many people. Why don't you save the date information in a data-* attribute and use the input field only for showing the date in the selected format?
comment:8 Changed 11 years ago by
Because that's not how any of our input-based widgets work. The input itself is the canonical data source. If you don't want it to be, then use a different trigger with an alt field or just create an inline datepicker and manage the showing/hiding yourself. If you need help, please use the forums.
Datepicker is only designed to pick a full date.