Search and Top Navigation
#7759 closed bug (notabug)
Opened October 03, 2011 09:12AM UTC
Closed October 03, 2011 01:01PM UTC
Last modified February 15, 2016 03:38PM UTC
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
Attachments (0)
Change History (10)
Changed October 03, 2011 01:01PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Changed March 01, 2012 03:01AM UTC by comment:3
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.
Changed March 01, 2012 03:15AM UTC by comment:4
The text field is the canonical data source. You can't not have a year.
Changed September 03, 2012 03:50PM UTC by comment:7
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?
Changed September 03, 2012 03:57PM UTC by comment:8
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.
Changed February 15, 2016 03:38PM UTC by comment:10
#14918 is a duplicate of this ticket.
Datepicker is only designed to pick a full date.