I have a NodeJS application that uses Fullcalendar on the client side.
This very same app, when run on my dev environment renders the calendar with the correct dates and times.
When I run it on the production box, the dates and times are being rendered wrong. It's just like it's ignoring the timezone information. What's weird is that the client is still me and that the production server is sending as output the same JSON that you can see there:
[{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-18T22:00:00.000Z","end":"2014-06-19T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-19T22:00:00.000Z","end":"2014-06-20T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-20T22:00:00.000Z","end":"2014-06-21T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-21T22:00:00.000Z","end":"2014-06-22T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-22T22:00:00.000Z","end":"2014-06-23T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-23T22:00:00.000Z","end":"2014-06-24T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-24T22:00:00.000Z","end":"2014-06-25T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-25T22:00:00.000Z","end":"2014-06-26T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-26T22:00:00.000Z","end":"2014-06-27T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-27T22:00:00.000Z","end":"2014-06-28T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-28T22:00:00.000Z","end":"2014-06-29T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-29T22:00:00.000Z","end":"2014-06-30T18:00:27.000Z","allDay":false},{"id":"53a2fe7beec975b1095ef5c9","title":"aaa","start":"2014-06-18T06:00:00.000Z","end":"2014-06-18T11:00:00.000Z","allDay":false}]
The calendar is being initialized this way:
$(document).ready(function() {
$('#calendar').fullCalendar({
events: '/scheduler/events',
firstDay: 1,
timeFormat: 'HH:mm',
header: {
left: 'title',
center: '',
right: 'today, prev, next, month, agendaWeek'
},
timezone: "local",
dayClick: function(date, jsEvent, view) {
},
eventClick: function(event, jsEvent, view) {
});
}
});
As an example, I'm in the CEST timezone and the very first record of the JSON should display as start 2014-06-19 00:00:00 and end 2014-06-19 20:00:27 but it displays 2014-06-18 22:00:00 and 2014-06-19 18:00:27
I tried setting the timezone option of Fullcalendar to "local", false, "UTC", "CEST" but with no luck.
Any idea of what might be wrong?
Thanks!
Thanks to the author of Fullcalendar who pointed me in the right direction. The answer is that Node JS doesn't get the correct timezone from the OS for some unknown reason. It does get it on my development box (OSX) but on the production one (Linux) it doesn't.
I simply added this to my start script and now it works like a charm:
export TZ="Europe/Rome"
Related
I have a Table in the google docs and want to change its alignment to -0.71 but i do not see any Python API to change table properties. This can be done easily using following UI on google UI (as shown below):
I also tries looking at following requests but could not find it:
updateTableColumnProperties
updateTableCellStyle
For debugging, i created a doc with mentioned alignment and tried dumping JSON of it. But i do not see alignment keyword in the JSON.
Thanks #jescanellas for reply.
I found a hack, this may not be the best solution but works.
1) Update paragraph style and set the indentation, alignment as required. Here the start_idx is the index where table needs to be created.
request = [{
'updateParagraphStyle': {
'paragraphStyle': {
'namedStyleType': 'HEADING_5',
'direction': 'LEFT_TO_RIGHT',
'alignment': 'START',
'indentFirstLine': {
'magnitude': -51.839999999999996,
'unit': 'PT'
},
'indentStart': {
'magnitude': -51.839999999999996,
'unit': 'PT'
},
},
'fields': '*',
'range': {
'startIndex': start_idx,
'endIndex': end_idx
}
}
}]
2) Create the table, it will get created at new indented place.
request = [{
'insertTable': {
'rows': 1,
'columns': 1,
'location': {
'segmentId':'',
'index': start_idx
}
},
}]
It's not currently possible to do so. You can create a Feature Request for the Docs API, and you can also subscribe to this one for Apps Script by clicking on the star next to the Issue number to give more priority to the request and to receive updates.
In case of the second request being implemented, you could call the script from the command line using Clasp.
I'm using the following code and it worked but all of a sudden it is not working. I have another method that gets free busy using the same auth and everything is working fine. Below is my method as well as the console log.
def createEvent(title, event_description, mentor, mentee, start_time, end_time)
calendar_api = Google::Apis::CalendarV3::CalendarService.new
calendar_api.authorization = #auth
event = Google::Apis::CalendarV3::Event.new(
summary: title,
description: event_description,
start: {
date_time: start_time.iso8601,
time_zone: 'Etc/UTC',
},
end: {
date_time: end_time.iso8601,
time_zone: 'Etc/UTC',
},
attendees: [
{email: mentor},
{email: mentee},
],
reminders: {
use_default: true,
},
)
calendar_api.insert_event('primary', event)
end
The console error I am getting is as shown
Sending HTTP post https://www.googleapis.com/calendar/v3/calendars/primary/events?
400
#<Hurley::Response POST https://www.googleapis.com/calendar/v3/calendars/primary/events == 400 (276 bytes) 300ms>
Caught error invalid
Error - #<Google::Apis::ClientError: invalid>
As suggested here, try putting a breakpoint in a debug session to know where the error was coming from. Also, the warning will be solved if you upgrade to 3.0 or turn off deprecations using Representable.deprecations = false. You may also check these references: https://github.com/google/google-api-ruby-client/issues/407 and https://github.com/trailblazer/representable/issues/195
The following JSON is sent, as the “attachments” argument, in a call to the chat.postMessage API method. The message is posted to an individual user (not a shared channel) and per documentation I was expecting the timestamps to be displayed in the target user’s local timezone. Instead they are always displayed in UTC, so am I doing something wrong?
[
{
"mrkdwn_in": [
"text"
],
"title": "Important alert",
"footer": "MyCodeThing",
"fallback": "Important alert summary",
"text": "A thing with a date just happened <!date^1475148495^{date_short_pretty} at {time}|Sep 29 at 09:28 PM UTC>\n\nUsers Name from *Company & Associates*",
"fields": [
{
"short": false,
"title": "",
"value": ""
},
{
"short": false,
"title": "Device",
"value": "Using Chrome on Other."
}
],
"footer_icon": "https://anysite.domain.com/static/img/image_only_16.png",
"color": "#f54b0a"
}
]
It looks to me as though it completely ignores the timezone in the preferences, and it shows the time in the current timezone for the PC it is running on. Which, in my case, is UTC. I can change the timezone preference in slack to whatever I want, but it comes up UTC on the computer where I have this problem.
I can use the same account, open the same chat history on another PC, and it shows it in the correct time according to that PC's OS.
This is in the app, not the browser version. I don't know the behavior of the browser version.
Since a while, I'm using the google calendar from fullcalendar.io
lately I noticed that my events are 'published' in my timezone (Europe/brussels) when I click on the event and when I'm not logged in to my google's account.
They are listed correct in the calenders month view as well as in the google calendar.
Side note: When I log in to my google account, the time of my event is correct in my event.
Here is a piece of my code:
$(document).ready(function() {
$('#calendar').fullCalendar({
firstDay:1,
weekNumbers:true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'month',
eventClick: function(event) {
// opens events in a popup window
window.open(event.url, 'gcalevent', 'width=700,height=600');
return false;
},
Any help or suggestions?
Thanks in advance
I am currently having a problem with getting the correct time for an event via Facebook's graph API. There are some events showing the correct time and some are not. Even if I am calculating the timezone wrongly, it just doesn't make sense to me.
For example I have the following three events: "Brunch", "Champions league finale" and "Pfingst-Tanz". That's what the graph API gives back:
{
"data": [
{
"name": "Pfingst-Tanz",
"start_time": "2012-05-27T10:00:00",
"end_time": "2012-05-27T14:00:00",
"timezone": "Europe/Berlin",
"location": "...",
"id": "..."
},
{
"name": "Championsleague Finale",
"start_time": "2012-05-19T11:45:00",
"end_time": "2012-05-19T14:45:00",
"timezone": "Europe/Berlin",
"location": "...",
"id": "..."
},
{
"name": "Muttertagsbrunch",
"start_time": "2012-05-13T10:00:00",
"end_time": "2012-05-13T14:00:00",
"location": "...",
"id": "..."
}
],
"paging": { … }
}
On the Facebook page it shows:
Pfingst-Tanz 19:00 (07:00 pm)
Champions league finale 20:45 (8:45 pm)
Brunch 10:00 (10:00 am)
Which results in:
Pfingst-Tanz: Facebook page correct, API incorrect or TZ incorrect in my app
(Champions league finale: don't know, never mind)
Brunch: Facebook page and API correct and same
This just does not correspond to each other. From what I understand it has to be either all wrong or none wrong, but not just 1/3 or 2/3 events. Does anyone have an idea, or am I just too blind to see something?
Your "Brunch" event doesn't include a time zone, so it can't be adjusted to the user's local time zone, which is what I assume Facebook is doing.
It's not immediately clear to me whether the start_time and end_time values are meant to represent the local start/end times (in the given time zone) or the UTC start/end times, but that should be easy enough to work out based on the data (and documentation, hopefully). I suspect it's the UTC start/end when there's a time zone specified, but the local start/end otherwise.