You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug dayjs.tz(instance, timezone) returns different values depending on the type of input. If the instance is of type string, then the value returned is correct and as per the documentation: it sets the time in the specified timezone. But if it is anything else, it doesn't work properly: it sets the time in the local timezone, then updates the timezone to the specified timezone.
For example, if this is the input:
// local timezone: UTC + 5:30consttz='Asia/Tokyo';// UTC + 9constdate=newDate(2023,9,8,0,0,0,0);consta=dayjs.tz('2023-10-08',tz);constb=dayjs.tz(date,tz);constc=dayjs.tz(date.valueOf(),tz);constd=dayjs.tz({year: 2023,month: 9,day: 8},tz);console.info('test a',a.toISOString(),a.format());console.info('test b',b.toISOString(),b.format());console.info('test c',c.toISOString(),c.format());console.info('test d',d.toISOString(),d.format());
then this is the output:
test a 2023-10-07T15:00:00.000Z 2023-10-08T00:00:00+09:00
test b 2023-10-07T18:30:00.000Z 2023-10-08T03:30:00+09:00
test c 2023-10-07T18:30:00.000Z 2023-10-08T03:30:00+09:00
test d 2023-10-07T18:30:00.000Z 2023-10-08T03:30:00+09:00
Expected behavior
The output should be the same for all types of instances.
Information
Day.js Version: v1.11.11
OS: Linux
Browser: Firefox 126.0.1
Time zone: UTC + 5:30
The text was updated successfully, but these errors were encountered:
Describe the bug
dayjs.tz(instance, timezone)
returns different values depending on the type of input. If theinstance
is of type string, then the value returned is correct and as per the documentation: it sets the time in the specified timezone. But if it is anything else, it doesn't work properly: it sets the time in the local timezone, then updates the timezone to the specified timezone.For example, if this is the input:
then this is the output:
Expected behavior
The output should be the same for all types of instances.
Information
The text was updated successfully, but these errors were encountered: