question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] dayjs.tz do nothing

See original GitHub issue

Describe the bug

moment.tz("2022-06-13T13:47:25Z", "America/New_York").format('YYYY-MM-DD HH:mm') -> 2022-06-13 09:47
dayjs.tz("2022-06-13T13:47:25Z", "America/New_York").format('YYYY-MM-DD HH:mm') -> 2022-06-13 13:47
dayjs.tz("2022-06-13T13:47:25Z", "Asia/Tokyo").format('YYYY-MM-DD HH:mm') -> 2022-06-13 13:47

Expected behavior dayjs.tz look like do nothing

Information

  • Day.js Version dayjs.org site console

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kravorkidcommented, Jun 30, 2022

@iamkun @sxzz is this the intented behavior of dayjs.tz("2014-06-01 12:00", "America/New_York") or is this a real bug and both dayjs().tz() and dayjs.tz() should give the same result ? If so will it be fixe in dayjs 2.0 ?

1reaction
lilonghecommented, Jun 30, 2022

@kravorkid emmm, Ok, it’s so weird. Maybe change the doc can help more people. Time Zone
in this link, two different usage seems to be the same, but actually different.

dayjs.extend(utc)
dayjs.extend(timezone)

dayjs.tz("2014-06-01 12:00", "America/New_York")
dayjs("2014-06-01 12:00").tz("America/New_York")
dayjs.tz("2014-06-01 12:00", "America/New_York").format() -> 2014-06-01T12:00:00-04:00
dayjs.tz("2014-06-01 12:00", "America/New_York").format("YYYY-MM-DD HH:mm") -> 2014-06-01 12:00
dayjs("2014-06-01 12:00").tz("America/New_York").format() -> 2014-06-01T00:00:00-04:00
dayjs("2014-06-01 12:00").tz("America/New_York").format("YYYY-MM-DD HH:mm") -> 2014-06-01 00:00
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: dayjs(...).tz is not a function - Stack Overflow
I am getting this error. TypeError: ...
Read more >
iamkun/dayjs - Gitter
I need to compare the current time to a string that I convert into a date object. I can't seem to find a...
Read more >
Working with Dates and Times with Day.js
Day.js can be included as a JavaScript file from a CDN or local file ... The code below will produce an error since...
Read more >
The Complete Guide to Day.js - Mirza Leka - Medium
The library will no longer get updates and the team recommended a few ... To install Day.js in your Node.js do the following:...
Read more >
How to use the dayjs.utc function in dayjs - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found