-
Notifications
You must be signed in to change notification settings - Fork 9
Included timezone shift #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,14 @@ module.exports.parseString = function(st, max) { | |
| events[event_count][k].value = getDate(params["VALUE"], value); | ||
| } else { | ||
| if(params["TZID"] !== undefined) { | ||
| //Allow to parse as per GMT | ||
| events[event_count][k].value = getDate(undefined, value.concat('Z')); | ||
| //If a locale exists, strip preceeding / | ||
| if(params["TZID"].search(/\//) != -1){ | ||
| params["TZID"] = params["TZID"].slice(1); | ||
| } | ||
| //Pass to toLocaleString to reduce to GMT based on timezone | ||
| events[event_count][k].value.toLocaleString(undefined, {timeZone: params["TZID"]}); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this line do?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is it returns a correctly coded datetime using the correct locale. |
||
| } else { | ||
| events[event_count][k].value = getDate(undefined, value); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this does exactly what you want it to do, it seems that this check will find any
/in the TZID then take a substring, so, for example, wouldn't this:match for your
.search(...)call? Which would then end up withmerica/Los_Angeles?I think you would just want to check if the string starts with
/, which simplifies the call toif(params["TZID"].startsWith('/'))There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes agree re the search. I'll make the change to the code and commit the change. I'll also write a test case for it and submit. Thanks for the advice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good - I'm about to head on a trip for a bit over a week tomorrow so I may go quiet here, but I will try my best to come back to this promptly after my trip. I hope you have a workaround for the time being.