I was developing a timetable using dayjs. I would like to set the timetable to show something likes UTC-9 date regardless of user's local time. I tried with dayjs's timezone and utc mode. Both change the time to the correct time but not the date. If I set PC time to other date, dayjs still showing that date instead of UTC-9 date. Thanks.
CodePudding user response:
There is a nice example in the day.js documentation itself.
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")