Urgent Help needed with Date in Calendar

Help please, I don’t quite understand why the Date is showing correctly on the Calendar, but when I use the date in code it shows like two hours later. Any help appreciated. Am running against a deadline. TY.

Two quick questions.  What is your timezone in Salesforce Setup?  What is your timezone for your local OS?

SF TimeZone: My TimeZone:

Thank you so much by the way for responding so quickly.

Ok, this makes sense then.  You’re actually seeing the same times there.  Throughout Skuid we made the decision to respect your timezone in SF setup instead of your OS’s timezone.  So the time you’re seeing in the calendar is in PST, but the time Javascript is showing you is in your browser’s timezone.  They’re actually the same point in time.

Obviously, when writing a robust application, we need to deal with these cases when the user’s local timezone, (Javascript’s timezone) is different than the timezone they’ve specified in Salesforce Setup.

There’s a function in Skuid’s skuid.time api called skuid.time.getLocalDateTime() that you might want to use instead of skuid.time.getDateTime().  I thought this was documented, but when I checked the docs I see that it isn’t. (Sorry about that).

skuid.time.getLocalDateTime() will actually return the “wrong” javascript date, but offset for the difference between the users salesforce timezone and the browser’s timezone.  This however can help to handle those cases where you want your app to function correctly when the user’s two timezones differ.

Does this make sense?  I’d be glad to elaborate more if necessary.

Thank you, I modified my function like so: function getDateTime(value){ var sfDateTime = skuid.time.parseSFDateTime(value); return skuid.time.getLocalDateTime(sfDateTime); } It works correctly now. How about when I save it back to the mode: is there a trick to that too? Thanks,

Yeah.  

skuid.time.getRealJSDateTimeFromLocal(localDate) will convert from your offset date back to the actual “Correct” javascript date.