I have a standard Jquery date picker which shows 2 textboxes.
One textbox has the date like so: 15/11/2011.
The other textbox shows the time like so: 13:15.
Combining the values will give me 15/11/2011 13:15.
I want to be able to render an event using fullcalendar using that string (15/11/2011 13:15).
I'm stumped whether to use a jquery date picker format function, somehow squeeze this into a new Js data object or use some date library to do the conversion.
What is the best way to achieve it? When passing the date to fullcalendar plugin it states the date object must be like so:
*
When specifying Event Objects for events or eventSources, you may
specify a string in IETF format (ex: "Wed, 18 Oct 2009 13:00:00 EST"),
a string in ISO8601 format (ex: "2009-11-05T13:15:30Z") or a UNIX
timestamp.
*
For now I've basically sent the date to the server for persistence and then re-fetch the events. I let FullCalendar work out the date by pulling the date from a Json list. This saves having to trying to convert the date and then add it to the calendar on an individual event basis.
Related
I'm facing one issue in my MVC application. In one module I'm using kendo-ui grid (Ex. #(Html.Kendo().Grid(Model))). Issue is, its change the DateTime object value when it render on the web browser. Ex. If my DateTimeobject value on server side is '2016-09-20 00:00:00' and when it renders on the browser then this value becomes '2016-09-20 05:30:00' (India time zone +5:30), on client side rendering DateTime object value add the time zone value of the user's browser. so my DateTime object value is changed and I do not want to change it. Is there any solution available for this kind of problems?
The date values are changed by the browser, because JavaScript Date objects are represented in the local time zone. The workaround is to use UTC:
http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/how-to/utc-time-on-both-server-and-client
I'm trying to convert some dates that I have stored on the server (in UTC). I'd like to convert them to the user's time so it would be pretty for their time zone.
However, I'm not sure about how to go about doing that. What's the best practice to get the user's timezone from the request in the controller?
The timezone is not passed in the request headers. If you had the users time zone stored in a profile setting then you can easily format the date according to this but its not something you can just grab from the request. There are ways to do this in JavaScript.
I am still new to Ruby and am working on a project that involves users logging in through different calendar services, then displays it on a custom calendar on screen, for activity booking purposes.
I have been able to get the date in a String format. I am using the calendar I created after following the Railscast #231 to display the user's events. However, this calendar requires a date format to display the data.
I have tried everything I can, from Time.parse("start"), which gave me an error of:
"no implicit conversion of Date into String"
Thanks for any help in advance.I have a feeling I am going about this completely wrong. But I am so close to getting it to work I can taste it. haha
If you want to convert a string to a date use string.to_date.
Examples:
Time.now.to_s
=> "2014-02-15 04:07:13 +0000"
Time.now.to_s.to_date
=> Sat, 15 Feb 2014
Right now I'm using a datetimepicker to make it easy for users to select an exact date/time and present that in a readable format. However, rails does not like that format and can't Time.parse it.
I've tried out the Chronic gem, and it's close, but it still can't parse something like:
02/27/2013 08:36:57 PM
How can I make user inputted time into an acceptable format for my database? (mongo)
I'm using this gem: https://github.com/asgeo1/bootstrap-datetimepicker-rails
based on this datetimepicker: https://github.com/tarruda/bootstrap-datetimepicker
demonstrated here: http://tarruda.github.com/bootstrap-datetimepicker/
Check out the timeliness gem:
https://github.com/adzap/timeliness
The date picker will always return the value in a standard format, so you can parse it.
#02/27/2013 08:36:57 PM
month = input[0..1]
date = input[3..4]
year = input[6..9]
datetime = DateTime.civil(input[6..9], input[0..1], input[3..4],
input[11..12], input[14..15], input[17..18])
I am sitting on a really strange issue with grails and the js fullcalendar.
I have users which have their own timezones stored in the database e.g. ECT
When users insert their events all dates are stored in UTC. This is set in the Bootstrap with:
TimeZone.setDefault(TimeZone.getTimeZone("UTC"))
I heard its a good idea to store all dates in UTC. So when a german user is entering 1.12.2012 08:00 its stored with 1.12.2012 07:00. This is fine.
Now when I want to display those values from the db into the calendar the timezone is not considered by fullcalendar(i set ignoreTimezone: false) so the dates are comming over json with 2012-12-01 08:00+01:00 but its display as 08:00 am and not 07:00. What am I doing wrong here? this issue is driving me really crazy.
Can you check in by manually adding the event in javascript?I guess the problem is with the JSON format. The parseISO8601 function inside fullcalendar.js expects your object to be in some format and so if your format is not correct,then you have to experiment and see what works.
Quoted from fullcalendar website.
When specifying Event Objects for events or eventSources, you may
specify a string in IETF format (ex: "Wed, 18 Oct 2009 13:00:00 EST"),
a string in ISO8601 format (ex: "2009-11-05T13:15:30Z") or a UNIX
timestamp.