fullcalendar js timezone offset issue - timezone

I'm using fullcalendar with timezone option set to to local. One of events fetched from server looks file follows.
{
allDay: true
className: "term"
end: 1425949200000
id: "5519341d300416ba3b825a65"
rendering: "background"
start: 1424629800000
title: "Term 1"
}
the end date when converted to a date object is Tue Mar 10 2015 06:30:00 GMT+0530 (IST). But the calendar when rendered shows the event only till 9th of March. I'm not sure whether it is visible in screenshot since it is a background event(light colour). I'm accessing from the same timezone so what is happening here?

Related

simpleWeather and moment.js - invalid date with js-geolocation in Germany

Hey ho =)
I wanted to create a Weather Plugin for my Website. So i choose the simpleWeather Plugin.
The simpleWeather Plugin used the moment.js lib to get the last updated time. But the Plugin itself not provide a language option.
My standard location is "Kiel, Germany".
But it's not working and says "Invalid Date".
I have no idea, why!
Can someone help me, please?
/* Does your browser support geolocation? */
if ("geolocation" in navigator) {
$('.js-geolocation').show();
} else {
$('.js-geolocation').hide();
}
/* Where in the world are you? */
$('.js-geolocation').on('click', function() {
navigator.geolocation.getCurrentPosition(function(position) {
getWeather(position.coords.latitude+','+position.coords.longitude); //load weather using your lat/lng coordinates
});
});
$(document).ready(function() {
getWeather('Kiel',''); //#params location, woeid //Get the initial weather.
});
function getWeather(location, woeid) {
$.simpleWeather({
//20065908 KIEL woeid
location: location,
woeid: woeid,
unit: 'c',
success: function(weather) {
html = '<ul>Today: <i class="icon-'+weather.code+'"></i><br />';
html += '<li>'+weather.temp+'°'+weather.units.temp+'</li>';
html += '<li>'+weather.city+', '+weather.region+'</li></ul>';
//Don't forget to include the moment.js plugin.
var timestamp = moment(weather.updated);
html += '<p>Weather updated '+moment(timestamp).fromNow()+'</p>';
html += '<p>Weather updated at '+moment(timestamp).format('MM/DD/YY h:mma')+'</p>';
for(var i=0;i<weather.forecast.length;i++) {
html += ''+weather.forecast[i].day+': <i class="icon-'+weather.forecast[i].code+ '"></i>';
}
$("#weather").html(html);
},
error: function(error) {
$("#weather").html('<p>'+error+'</p>');
}
});
}
codepen
I don't know how exactly the geolocation works... but I think that moment.js use the geolocation to set a language.
So I tried to set the moment.js locale globaly to 'en', but it's also not working how I expected.
The problem is that Yahoo Weather (simpleWeather's data source) does not follow its own standard for date formatting... The weather.updated date in the response looks like this: Tue, 20 Oct 2015 3:58 pm CEST. This is not a standard date format, thus Moment.js cannot parse is correctly (because there are some not unique time zone abbreviations, e.g. CST).
A quote from Yahoo Dev documentation:
pubDate: The date and time this forecast was posted, in the
date format defined by RFC822 Section 5, for example Mon, 25 Sep
17:25:18 -0700.
Clearly, this is not the case. Moment.js would happily parse RFC822 formatted date. Yahoo should fix this issue.
However if you really want to use this feature and you have a fixed location, there is a way to parse the local date from Yahoo by changing this line:
var timestamp = moment(weather.updated);
to this:
var timestamp = moment(weather.updated, "ddd, DD MMM YYYY HH:mm A");
And correct this date considering the visitor's time zone.

datePicker showing one day previous wrong day in grails

In edit and print (html print) mode, I have get one day previous date. I have used mysql database. My domain like
class Immunization {
------
Date doseOneDue
Date doseOneGiven
----
}
I have use datepicker in view like
<g:datePicker name="doseOneDue" precision="day" noSelection="['': '']"
value="${immunizationInstance?.doseOneDue}"
relativeYears="[-5..5]" default="none"/>
Now problem is:
suppose doseOneDue is '2015-08-30', But when I showing it in datePicker in edit mode then it is selecting '29 - 08 - 2015', Also in html print option showing also one day less. How can handle this problem.

Using jQueryUI datepicker with KendoUI grid

I have used KendoUI grid in my web application. It runs at batch editing mode, and a date column is in the grid.
For some reasons, I can't using KendoUI datepicker to show the date when a cell in the column clicked. Instead,I must use the jQueryUI datepicker in edting mode.
But when I was showing the jquery date picker, the date can not be displayed with the format which I have set.
Following is my configuration.
$("#"+currGrid.options.girdContainerId).kendoGrid({
dataSource: kendoGridDataSource,
...
columns:[
...
{
field:'StartDate',
editor : function(container, options){
var $input = $("<input />").attr("name",options.field).appendTo(container);
$input.datepicker({
dateFormat:"yy/mm/dd",
});
},
format:"{0:yyyy/MM/dd hh:mm:ss}",
},
...
},
,
editable: true
I have set the format as "yyyy/mm/dd".But when I focus in the cell, the string likes "Wed Jun 17 2015 15:00:00 GMT+0900 (東京 (標準時))" will be displayed.
How can I control the value displayed in datepicker when I focus in cell first time?
Best regards

Kendoui higri datepicker

As per the link and the code given below you can see that I defined the culture for the date picker to be ar-SA which is the Hijri date.
You can see that it is getting the wrong today date and year. How can I fix this>
It should get 1435 but it gets 2013 in the footer and the initial date.
http://jsfiddle.net/zvjWe/786/
kendo.culture("ar-SA");
$("#datepicker").kendoDatePicker({
format:"d/M/yyyy",
min:new Date(1300,0,1)
});

Fullcalendar time zones

I have a RoR app using Fullcalendar - running on Heroku.
The calendar view shows an event as 9am - 10am. When I view a list of the time, I get 4p - 7pm.
Does it has something to do with timezone?
I tried setting ignoreTimeZone true and then false:
$(document).ready ->
$('#calendar').fullCalendar
editable: true,
ignoreTimezone: true,
header:
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
defaultView: 'month',
height: 500,
slotMinutes: 30,
Thanks for the help!
Here is an example - the database record has start_at 16:00 (4pm) but the Fullcallendar view shows it starting at 9am
Your events list (index.html.erb or the like) shows UTC times while fullcalendar shows times in your browser's detected timezone.
In order to fix this, you should set the timezone of each request thread to the user's timezone. This should work:
In your events controller, add this:
before_filter set_time_zone
def set_time_zone
(...)
end
Checkout the rest of the code in this post:
https://stackoverflow.com/a/942865/336806
There's also this neat gem that I'm using myself:
https://github.com/scottwater/detect_timezone_rails
The following fixed the problem:
$ heroku config:add TZ=America/Denver

Resources