Open
Conversation
Parse time to expected time zone.
Example:
toTimeZone('2017/01/01 00:00:00Z', 'Asia/Tokyo')
=> 2017/01/01 09:00:00
Owner
|
Hi @nev-tuannm4 Thanks for the contribution 🍻 Would you mind adding some test cases? |
Author
|
I have upload some test case for toTimeZone function. Please check new pull request. |
Owner
|
Hi @nev-tuannm4 Can you merge the tests #106 with in the same PR #104 with the implementation? |
phstc
requested changes
Dec 1, 2017
| // timeZone : Asia/Tokyo etc.. | ||
| // clear LRM in IE | ||
| var date = new Date(value).toLocaleString('en-US', {timeZone: timeZone, hour12: false}).replace(/‎|\u200E/gi, ''); | ||
| return this.date(new Date(date), format || 'MM/dd/yyyy HH:mm:ss'); |
Owner
There was a problem hiding this comment.
@nev-tuannm4 could you move the change to https://github.com/phstc/jquery-dateFormat/blob/master/src/dateFormat.js, this dist/jquery-dateFormat.js is the compiled file.
|
I needed the toTimeZone function quite recently and implemented this PR, but I had to change "hour12: false" to "hourCycle: 'h23'" to make it work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parse time to expected time zone.
Example:
toTimeZone('2017/01/01 00:00:00Z', 'Asia/Tokyo')
=> 2017/01/01 09:00:00