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

RangeError: Maximum call stack size exceeded when using timezone-mock #44

Open
Zeikko opened this issue Jan 23, 2025 · 0 comments
Open

Comments

@Zeikko
Copy link

Zeikko commented Jan 23, 2025

I'm using timezone-mock to test that our time formatting works correctly in different timezones.

This worked fine with date-fns/tz 1.1.2 but when upgrading to 1.2.0 I get RangeError: Maximum call stack size exceeded error with the following stack trace:

RangeError: Maximum call stack size exceeded

at TZDate.MockDate.<computed> (node_modules/timezone-mock/index.js:78:37)
at TZDate.setTime (node_modules/@date-fns/tz/date/mini.cjs:52:28)
at TZDate.MockDate.<computed> (node_modules/timezone-mock/index.js:90:26)
at TZDate.setTime (node_modules/@date-fns/tz/date/mini.cjs:52:28)
at TZDate.MockDate.<computed> (node_modules/timezone-mock/index.js:90:26)
at TZDate.setTime (node_modules/@date-fns/tz/date/mini.cjs:52:28)
at TZDate.MockDate.<computed> (node_modules/timezone-mock/index.js:90:26)
at TZDate.setTime (node_modules/@date-fns/tz/date/mini.cjs:52:28)
...

The minimum reproduction steps are:

import timezoneMock from 'timezone-mock'
import { format } from 'date-fns'
import { tz } from '@date-fns/tz'

timezoneMock.register('US/Pacific')
format('2020-01-01T15:30:00+02:00', 'H.mm', { in: tz('Europe/Helsinki') })

Package versions used:

@date-fns/tz: 1.2.0
date-fns: 4.1.0
timezone-mock: 1.3.4

I'm not sure if I should file the issue in date-fns/tz or timezone-mock but I'll start from here since the update of date-fns/tz caused the issue for me.

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