We've received a request to be able to change the browser's timezone dynamically - Is there any way to do this in SmartClient?
Announcement
Collapse
No announcement yet.
X
-
Currently for date-time fields, before we send the data back to the server, we re-set it to GMT 00:00 and then on the server side, we re-set it to the server time. The process of doing this uses the javascript date object to get the timezone offset. If we start using Time.setDefaultDisplayTimezone(), we need to figure out the timezone offset based on this timezone instead of the browser timezone. Is there any out-of-box way of doing this? Or do we need to do the calculation ourselves?
Comment
-
I need some clarification with the Time class. I'd like to be able to create a new date instance using the timezone I have set on the Time class. I tried the following code but it gives me a date marked as -5:00GMT - I know createDate() is deprecrated but not sure what else to use.
Code:isc.Time.setDefaultDisplayTimezone("-3:30"); isc.IButton.create({ left:120, top:240, title:"Rollover off", click:"isc.warn(isc.Time.createDate());" })
Comment
-
parseInput does not seem to change the timezone according to the default that I have specified? I want to be able to specify new Date() converted into -3:30 timezone
Code:isc.Time.setDefaultDisplayTimezone("-3:30"); isc.IButton.create({ left:120, top:240, title:"Rollover off", click:"alert(isc.Time.parseInput('1:00pm'));" })
Comment
-
Sorry, to clarify, a "time" value is a pure logical time with no meaningful day value or locale - it is not sensitive to timezone.
So what exactly do you want - a "date", "datetime" or "time" value?
And what specifically do you mean by it being "in" a given timezone? Generally a "datetime" value should be transmitted as epoch timestamp or a UTC String to minimize ambiguity. Then it can be *displayed* in various timezones but the value itself is not "in" a timezone and is not "converted" - it doesn't change, it's just displayed various ways. So please be specific about exactly what you want.
Comment
Comment