views:

277

answers:

2

Hello! Is there a way to change the "today" date in jquery.ui datepicker? With today, I mean today (class="ui-datepicker-today") and not the minDate or the current-selected date!

I figured out, that datepicker uses the system time for default values. Now I get the current date from my server and set it to my minDate. But I didn't find a way to set the today-date... It still uses my system date (there are some users out there whose systemdate is in the year 2000 or earlier).

Can U help me plz?

A: 

Are you looking ot set the default date when the jQuery UI Datepicker is opened?

If so the datepicker has an option to allow you to set this.

Shaun Humphries
no, the default date is the selected date on startup, but i am looking for the today date.
Newbie
+1  A: 

Based on the source, it doesn't look good.

var today = new Date();

That is always going to be the user's system date.

If you absolutely must fix this, look down a line; you could override $.datepicker._daylightSavingAdjust and return the date from your server *

But this is a bad idea. Why on earth do your users have their system date so messed up? Why is that your problem? If they complain, tell them to fix their clocks.

* I can't emphasize how bad an idea this is. That function is used to normalize most of the dates in the datepicker, so you'll have to write some pretty convoluted logic to keep from messing everything up. That may not even be feasible.

noah
Why on earth do your users have their system date so messed up?--> well, i don't know! I got a request from a user that he/she can't use my site, cause of the date from the datepicker is restricted to 2000 and 2001 (one year to the future is period, users are able to choose the date).
Newbie