Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone formatted incorrectly for timezones that are not rounded to a minute offset of UTC #21

Open
0xR opened this issue Aug 19, 2020 · 1 comment

Comments

@0xR
Copy link

0xR commented Aug 19, 2020

For example Amsterdam time before July 1937 is GMT +0h 19m 32.13s.

This means you get a partial minute which does not seem valid.

Example:

import {
  formatToTimeZone
} from 'date-fns-timezone';

console.log(
  formatToTimeZone(new Date(1937, 0), 'YYYY-MM-DDZ', {
   timeZone: 'Europe/Amsterdam',
 }),
);

Gives: 1937-01-01+00:19.533333333333335

@0xR
Copy link
Author

0xR commented Aug 19, 2020

My current workaround is rather pragmatic:

function roundAmsterdamTime(awsDate: string): string {
  return awsDate.replace(/:19\.5.*/, ':20');
}

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

No branches or pull requests

1 participant