dayjs: [BUG] dayjs.tz do nothing

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (7 by maintainers)

Most upvoted comments

@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 ?

@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