Skip to content

Conversation

PawelPlutaUek20
Copy link
Contributor

Partially addresses #1827

This solution does not work with rfc2822 dates, but fixes the issues with iso dates. It's a good step forward.

// timestamp number || js Date || Day.js
return d(input).tz(timezone)
}
const previousOffset = tzOffset(+d(), timezone)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamkun I moved this function below the return statement. There's not reason to compute this earlier.

expect(dayjs2.format()).toBe('2012-02-01T13:50:21-03:00')
const dayjs3 = dayjs.tz('2022-02-03T13:50:21-00:00', 'America/Recife')
expect(dayjs3.format()).toBe('2022-02-03T10:50:21-03:00')
// TODO: support rfc2822 dates
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might address this in a future pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants