Skip to main content

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 scottgonzalez comment:1

resolution: → invalid
status: newclosed

Datepicker is only designed to pick a full date.

Changed March 01, 2012 02:02AM UTC by scottgonzalez comment:2

#8151 is a duplicate of this ticket.

Changed March 01, 2012 03:01AM UTC by nfm 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 scottgonzalez comment:4

The text field is the canonical data source. You can't not have a year.

Changed August 20, 2012 05:58PM UTC by scottgonzalez comment:5

#8510 is a duplicate of this ticket.

Changed September 03, 2012 12:53PM UTC by scottgonzalez comment:6

#8546 is a duplicate of this ticket.

Changed September 03, 2012 03:50PM UTC by simon.sprankel 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 scottgonzalez 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 July 24, 2013 01:39PM UTC by scottgonzalez comment:9

#9454 is a duplicate of this ticket.

Changed February 15, 2016 03:38PM UTC by scottgonzalez comment:10

#14918 is a duplicate of this ticket.