Ticket #4870 (closed bug: fixed)

Opened 5 years ago

Last modified 4 years ago

yearRange doesn't work as expected

Reported by: mg Owned by:
Priority: minor Milestone: 1.8
Component: ui.datepicker Version: 1.7.2
Keywords: yearRange, datepicker Cc: mg@…, mh@…
Blocking: Blocked by:

Description

The bug occurs when one uses relative yearRange values with option changeYear: true, for example:

yearRange: '-100:+0',
changeYear: true,

With this example configuration list of years gets broken after date selection:

  1. List is 1909-2009
  2. We select 1909
  3. List is now 1809-1909
  4. We cannot select above 1909 - Bug

Attachments

datepicker1.png Download (13.9 KB) - added by mg 5 years ago.
datepicker2.png Download (1.8 KB) - added by mg 5 years ago.
datepicker3.png Download (13.4 KB) - added by mg 5 years ago.

Change History

Changed 5 years ago by mg

Changed 5 years ago by mg

Changed 5 years ago by mg

comment:1 in reply to: ↑ description Changed 4 years ago by BMCouto

It is a bug indeed, but it can be easily solved with something like:

yearRange: '-120:' + new Date().getFullYear()

Anyway it's something that should be fixed.

Replying to mg:

The bug occurs when one uses relative yearRange values with option changeYear: true, for example:

yearRange: '-100:+0',
changeYear: true,

With this example configuration list of years gets broken after date selection:

  1. List is 1909-2009
  2. We select 1909
  3. List is now 1809-1909
  4. We cannot select above 1909 - Bug

comment:2 Changed 4 years ago by joern.zaefferer

  • Milestone changed from TBD to 1.8

comment:3 Changed 4 years ago by kbwood

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r3485. Year range now has three formats: 'c-n:c+n' for years relative to the currently displayed year, '-n:+n' for years relative to today's year, 'nnnn:nnnn' absolute years, and the default value has changed to 'c-10:c+10' to retain backward compatibility. These formats may be mixed for the start and end of the range, e.g. '2000:-5'.

Note: See TracTickets for help on using tickets.