-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
the unix timestamp didnt not pick up the timezone change correctly #1159
Comments
You can use We will support custom format parsing in |
Did you mean 11:30 am for my current time at LA timezone to indicate 12:30pm at Denver ? Is there anyway to calculate this 1 hour difference with dayjs or I need to calculate it by my self ? Thank you. |
Sorry for the typo, it should be |
Which this '12:30' refers to ? '12:30 am' or '12:30 pm' ? I tired all '12:30' '12:30 am' '12:30 pm', but they gave me three different timestamps. |
it refers to '12:30 am', I think |
They are different : |
As I said above, we only support this format You can treat However, I do think 12:00 am and 12:00 pm should be the same time. |
## [1.9.4](v1.9.3...v1.9.4) (2020-10-23) ### Bug Fixes * Add descriptions to types ([#1148](#1148)) ([9a407a1](9a407a1)) * add devHelper plugin ([#1163](#1163)) ([de49dc8](de49dc8)) * Fix Hungarian (hu) locale ([#1112](#1112)) ([ab13754](ab13754)) * fix minMax plugin parsing empty array bug ([#1062](#1062)) ([368108b](368108b)) * update adding/subtracting Duration from Dayjs object ([#1156](#1156)) ([f861aca](f861aca)) * update en-NZ locale to use proper ordinal formatting function ([#1143](#1143)) ([fcdbc58](fcdbc58)) * update localeData plugin type ([#1116](#1116)) ([ee5a4ec](ee5a4ec)) * update timezone plugin to support custom parse format ([#1160](#1160)) ([48cbf31](48cbf31)), closes [#1159](#1159) * update timezone plugin to support keepLocalTime ([#1161](#1161)) ([1d429e5](1d429e5)), closes [#1149](#1149)
🎉 This issue has been resolved in version 1.9.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [1.9.4](iamkun/dayjs@v1.9.3...v1.9.4) (2020-10-23) ### Bug Fixes * Add descriptions to types ([#1148](iamkun/dayjs#1148)) ([9a407a1](iamkun/dayjs@9a407a1)) * add devHelper plugin ([#1163](iamkun/dayjs#1163)) ([de49dc8](iamkun/dayjs@de49dc8)) * Fix Hungarian (hu) locale ([#1112](iamkun/dayjs#1112)) ([ab13754](iamkun/dayjs@ab13754)) * fix minMax plugin parsing empty array bug ([#1062](iamkun/dayjs#1062)) ([368108b](iamkun/dayjs@368108b)) * update adding/subtracting Duration from Dayjs object ([#1156](iamkun/dayjs#1156)) ([f861aca](iamkun/dayjs@f861aca)) * update en-NZ locale to use proper ordinal formatting function ([#1143](iamkun/dayjs#1143)) ([fcdbc58](iamkun/dayjs@fcdbc58)) * update localeData plugin type ([#1116](iamkun/dayjs#1116)) ([ee5a4ec](iamkun/dayjs@ee5a4ec)) * update timezone plugin to support custom parse format ([#1160](iamkun/dayjs#1160)) ([48cbf31](iamkun/dayjs@48cbf31)), closes [#1159](iamkun/dayjs#1159) * update timezone plugin to support keepLocalTime ([#1161](iamkun/dayjs#1161)) ([1d429e5](iamkun/dayjs@1d429e5)), closes [#1149](iamkun/dayjs#1149)
## [1.9.4](iamkun/dayjs@v1.9.3...v1.9.4) (2020-10-23) ### Bug Fixes * Add descriptions to types ([#1148](iamkun/dayjs#1148)) ([9a407a1](iamkun/dayjs@9a407a1)) * add devHelper plugin ([#1163](iamkun/dayjs#1163)) ([de49dc8](iamkun/dayjs@de49dc8)) * Fix Hungarian (hu) locale ([#1112](iamkun/dayjs#1112)) ([ab13754](iamkun/dayjs@ab13754)) * fix minMax plugin parsing empty array bug ([#1062](iamkun/dayjs#1062)) ([368108b](iamkun/dayjs@368108b)) * update adding/subtracting Duration from Dayjs object ([#1156](iamkun/dayjs#1156)) ([f861aca](iamkun/dayjs@f861aca)) * update en-NZ locale to use proper ordinal formatting function ([#1143](iamkun/dayjs#1143)) ([fcdbc58](iamkun/dayjs@fcdbc58)) * update localeData plugin type ([#1116](iamkun/dayjs#1116)) ([ee5a4ec](iamkun/dayjs@ee5a4ec)) * update timezone plugin to support custom parse format ([#1160](iamkun/dayjs#1160)) ([48cbf31](iamkun/dayjs@48cbf31)), closes [#1159](iamkun/dayjs#1159) * update timezone plugin to support keepLocalTime ([#1161](iamkun/dayjs#1161)) ([1d429e5](iamkun/dayjs@1d429e5)), closes [#1149](iamkun/dayjs#1149)
## [1.9.4](iamkun/dayjs@v1.9.3...v1.9.4) (2020-10-23) ### Bug Fixes * Add descriptions to types ([#1148](iamkun/dayjs#1148)) ([9a407a1](iamkun/dayjs@9a407a1)) * add devHelper plugin ([#1163](iamkun/dayjs#1163)) ([de49dc8](iamkun/dayjs@de49dc8)) * Fix Hungarian (hu) locale ([#1112](iamkun/dayjs#1112)) ([ab13754](iamkun/dayjs@ab13754)) * fix minMax plugin parsing empty array bug ([#1062](iamkun/dayjs#1062)) ([368108b](iamkun/dayjs@368108b)) * update adding/subtracting Duration from Dayjs object ([#1156](iamkun/dayjs#1156)) ([f861aca](iamkun/dayjs@f861aca)) * update en-NZ locale to use proper ordinal formatting function ([#1143](iamkun/dayjs#1143)) ([fcdbc58](iamkun/dayjs@fcdbc58)) * update localeData plugin type ([#1116](iamkun/dayjs#1116)) ([ee5a4ec](iamkun/dayjs@ee5a4ec)) * update timezone plugin to support custom parse format ([#1160](iamkun/dayjs#1160)) ([48cbf31](iamkun/dayjs@48cbf31)), closes [#1159](iamkun/dayjs#1159) * update timezone plugin to support keepLocalTime ([#1161](iamkun/dayjs#1161)) ([1d429e5](iamkun/dayjs@1d429e5)), closes [#1149](iamkun/dayjs#1149)
Describe the bug
How to get the correct time stamp with a time on a specific timezone ?
I want to check the unix timestamp for 10/15/2020 12:30 PM at Denver, but neither of the approaches (3 and 4) works.
//Los Angeles (correct)
console.log("local notz:", dayjs("10/15/2020 12:30 PM").unix().toString());
// local notz:1602790200
2.
//Los Angeles (wrong)
console.log("local:", dayjs.tz("10/15/2020 12:30 PM").unix().toString());
// local: 1602815400
3.
// Denver (wrong)
console.log(
"denver:",
dayjs.tz("10/15/2020 12:30 PM", "America/Denver").unix().toString()
);
//denver: 1602811800
4.
// Denver (wrong)
console.log(
"denver sep:",
dayjs("10/15/2020 12:30 PM").tz("America/Denver").unix().toString()
);
//denver sep: 1602790200
Expected behavior
A clear and concise description of what you expected to happen.
1.1602790200
2.1602790200
3.1602793800
4.1602793800
Information
The text was updated successfully, but these errors were encountered: