If you follow the documentation and pass a date to the calendar method, then the relative description for yesterday is incorrect:
Consider:
dayjs() => Fri Mar 06 2020 14:05:09 GMT+0000 (Greenwich Mean Time)
dayjs().calendar(dayjs('2020-03-06')) => "Today at 2:05 PM" // correct dayjs().calendar(dayjs('2020-03-05')) => "Tomorrow at 2:05 PM" // wrong 05 should be yesterday
The same issue is present in the extended syntax:
`dayjs().calendar(dayjs('2020-03-05'), {...props}) => "Tomorrow at 2:05 PM" // wrong 05 should be yesterday``
If you pass a date to the dayjs constructor it seems to work fine.
dayjs(dayjs('2020-03-06')).calendar() => "Today at 12:00 AM" // correct dayjs(dayjs('2020-03-05')).calendar() => "Yesterday at 12:00 AM" // correct
Similarly:
dayjs(dayjs('2020-03-05')).calendar(null, {...props}) => "Yesterday at 12:00 AM" // correct
It seems this is not limited to just 'yesterday' but other descriptions for days of week etc.
If you follow the documentation and pass a date to the calendar method, then the relative description for yesterday is incorrect: Consider:
dayjs() => Fri Mar 06 2020 14:05:09 GMT+0000 (Greenwich Mean Time)
dayjs().calendar(dayjs('2020-03-06')) => "Today at 2:05 PM" // correct dayjs().calendar(dayjs('2020-03-05')) => "Tomorrow at 2:05 PM" // wrong 05 should be yesterday
The same issue is present in the extended syntax: `dayjs().calendar(dayjs('2020-03-05'), {...props}) => "Tomorrow at 2:05 PM" // wrong 05 should be yesterday``
If you pass a date to the dayjs constructor it seems to work fine.
dayjs(dayjs('2020-03-06')).calendar() => "Today at 12:00 AM" // correct dayjs(dayjs('2020-03-05')).calendar() => "Yesterday at 12:00 AM" // correct
Similarly:
dayjs(dayjs('2020-03-05')).calendar(null, {...props}) => "Yesterday at 12:00 AM" // correct
It seems this is not limited to just 'yesterday' but other descriptions for days of week etc.