Skip to main content

Search and Top Navigation

#5151 closed enhancement (worksforme)

Opened February 09, 2010 12:42AM UTC

Closed February 27, 2012 02:57PM UTC

Last modified October 11, 2012 09:15PM UTC

UI datepicker's defaultDate UI is confusing - please add some kind of todayDate option

Reported by: mesoconcepts Owned by:
Priority: minor Milestone:
Component: ui.datepicker Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

I've this weird use-case, which leads to rather confusing defaultDate UI:

  • The application lives in its server's time (EST)
  • I'm currently in Europe (CEST)
  • It's around 1am my time. Server time is 7pm "yesterday" ;-)
  • I use the defaultDate option to set the default date for the date picker to the server's time, as it should be

The fact of the matter is that I'd really need a todayDate option, rather than a defaultDate option. The todayDate option would override the browser's date, and be used as the defaultDate if the latter is not set separately.

At any rate, the current behavior, with the smoothness theme, when an empty date field is focused in the above-described setup:

  • datepicker highlights today's date (server date, set using defaultDate) in light grey
  • datepicker highlights today's date (my date) in orange (prominent)

The expected behavior, since the app is server-time centric:

  • datepicker highlights today's date (server date, set using defaultDate) in orange (prominent)
  • datepicker highlights today's date (my date) in light grey

Thanks in advance!

Attachments (1)
  • jquery.ui.datepicker.patch.txt (0.9 KB) - added by maxbarbul October 27, 2010 01:47PM UTC.

    Workaround of this issue. Added new option {Date} "todayDate". You need to set it whatever you want.

Change History (4)

Changed October 27, 2010 01:54PM UTC by maxbarbul comment:1

I've attached patch.

Workaround of this issue.

It uses new option "todayDate" of type Date.

You need to set it to your own today date.

Example:

var _today = new Date() // optimization
var userTimeZoneDiff = -360 // for -6 hours time zone

$('#elementId').datepicker({
    todayDate: new Date(
        _today.getTime() + (userTimeZoneDiff - _today.getTimezoneOffset()) * 60000
    )
})

Changed February 27, 2012 02:57PM UTC by jzaefferer comment:2

resolution: → worksforme
status: newclosed

I don't see how that is any different from any other custom day highlighting, which is already supported. The API for that may be awkward, but will get better with the redesign.

Changed February 27, 2012 03:26PM UTC by jzaefferer comment:3

Maybe I misunderstood this one, leaving #5427 open, seems to be about the same issue.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:4

milestone: TBD

Milestone TBD deleted