| Issue 593: | Setting "today" date | |
| 13 people starred this issue and may be notified of changes. | Back to list |
I have one problem: - i can't set the default date. The date, what is highlited in month view as "today". The problem is realy simple: - i wan't to set it to server current date, but now current date comes from the browser. tHANX
Aug 25, 2010
Project Member
#1
adamrs...@gmail.com
Aug 26, 2010
Yes. The "current date" cannot be forced to a specific date. It could be very good: - setCurrentDate function.
Oct 7, 2010
setting the "today" date to an arbitrary date seems like a hack to fix fullcalendar's lack of "timezone" features. if you were able to specify the timezone of the server and the client, and set the client and server to both the same timezone, this would likely fix the problem right?
Summary:
Setting "today" date
Status: Discussing
Oct 25, 2010
I need something like this also, take Google Calendar for example, it's current date and time is according to a user specified timezone, that is, the date and time of the calendar comes from the server and not the users computer, the user is asked though if he wants to change the user specified timezone to the one on his computer if it doesn't match.
I was going to do this by setting this in my template:
...
year: {{ year }},
month: {{ month }},
date: {{ date }},
...
But found out this is only for where in time the calendar starts, not for setting todays date, so I'd really like something like this but for setting the current date and time, or the ability to set timezones that then sets the correct date and time.
Any idea when this will be possible, 1.5? Do it myself?
Jul 13, 2011
Issue 1007 has been merged into this issue.
Jul 26, 2011
This would be nice.
Sep 24, 2011
The error is because the creators of this library did a very bad practice, the method causes the value today of the current date is taken from the date of the client side is doing this (today = new Date ();) . They should put that value as a property of the calendar and not like this, so when you click the button "today", takes you to the client's current date and not the set from the server.
Jul 11, 2012
Hey Adam, I dont think this would involve much to include this as an option. It could be a variable in defaults, allowing to pass a Date object or defaulting to 'new Date()'. A quick search returns 5 results for 'new Date()' which would need to be replaced. As a quick test I replaced these occurrences with a custom constructor - Eg new Date(1341573358000); And it worked as expected. Can you think of any issues arising here? Thanks
Jul 11, 2012
Regards your previous comment: >> setting the "today" date to an arbitrary date seems like a hack to fix fullcalendar's lack of "timezone" features. if you were able to specify the timezone of the server and the client, and set the client and server to both the same timezone, this would likely fix the problem right? This is not only required to fix timezone differences - but to avoid any differences in rendering the calendar depending on the local machines time settings. If for example the time & date on your local machine was completely off - the fullcalendar view could easily become unusable.
Jan 24, 2013
I also want any calendar date to be in certain timezone, which is neither browser nor server timezone, and managed to have it if have all start/end dates in ISO8601 format, ignoreTimezone true, and load calendar with options set for year, month, and date. But today is still in browser time. Then added 3 lines of code after each of 5 new Date(); to reset year, month, and date as per values set in options. Would you be able to do the same in future releases?
Feb 14, 2013
I have a slightly different scenario than those above. My application can "time travel" to a specified date/time, and I'd like to see what the client would've seen at that date/time. This means that it would be great to be able to specify FullCalendar's 'today' (date and time) value at creation (akin to 'timeFormat' or 'eventColor'). That way the server could push 'today' to the client and have it displayed correctly. A similar approach would work when users can specify their preferred timezone for the application, as opposed to using their browser settings.
May 22, 2013
As an alternative to the timezone function mentioned above, I've implemented a different fix which seems to have worked.
My site has a javascript ticking clock onscreenwhich is set via PHP to the system date using a global variable
var gametime=new Date("<?php echo date('d M Y H:i:s',time()); ?>");
Within fullcalendar.js, I searched for every occurrence of the variable "today"... wherever I saw it set as per
"today=new Date()" or "today=clearTime(new Date())"
I changed it to :
"today=gametime" or "today=clearTime(gametime)"
There was only 4-5 places it needed changing, and seems to be working fine.
Aug 13, 2013
(No comment was entered for this change.)
Status:
Accepted
Labels: Type-Feature
Sep 1, 2013
(No comment was entered for this change.)
Labels:
milestone-date
Sep 22, 2013
I'd suggest just adding a callback option curDate=function, with default new Date(), rather than having it as a fixed date (today=myDate). That way, whenever FC needs to obtain it, it can optionally go to server to sync with whatever "current" date-time should be displayed, including adjusting for daylight-saving in other TZ. Then you could also safely ignore whatever time the client has and use the "right" time.
Jan 25, 2014
in v2.0.0-beta: http://arshaw.com/fullcalendar/docs2/timezone/now/ please check it out
Jan 25, 2014
Great!!! Doc says now=string, but 2.0.0 checks for a function, which is even better. Thanks!
May 25, 2014
(No comment was entered for this change.)
Status:
Implemented
Jun 2, 2014
version 2 has been released with this change. http://blog.arshaw.com/1/post/2014/06/fullcalendar-2-released.html
Status:
Released
|
|
| ► Sign in to add a comment |