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

fix: it's just rude to assign to date now #1435

Merged
merged 3 commits into from
Sep 24, 2024
Merged

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Sep 24, 2024

We use Date.now liberally throughout the SDK

We also have a timestamp method used in a couple of places that tries to patch Date.now for browsers that don't have it.

That's IE8 and older which we don't aim to support anyway.

That timestamp method tries to assign back to Date.now, in some cases this will cause errors.

Since we use Date.now liberally elsewhere, let's just remove the offending method

see for e.g. https://posthog.com/questions/cannot-assign-to-read-only-property-now-of-function-function-date-native-code

Copy link

vercel bot commented Sep 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Sep 24, 2024 2:48pm

@pauldambra pauldambra requested review from benjackwhite, robbie-c and a team and removed request for a team September 24, 2024 14:43
@pauldambra pauldambra added the bump patch Bump patch version when this PR gets merged label Sep 24, 2024
Copy link

github-actions bot commented Sep 24, 2024

Size Change: -610 B (-0.02%)

Total Size: 2.79 MB

Filename Size Change
dist/array.full.js 349 kB -68 B (-0.02%)
dist/array.full.no-external.js 348 kB -68 B (-0.02%)
dist/array.js 165 kB -68 B (-0.04%)
dist/array.no-external.js 164 kB -67 B (-0.04%)
dist/main.js 165 kB -68 B (-0.04%)
dist/module.full.js 349 kB -68 B (-0.02%)
dist/module.full.no-external.js 348 kB -68 B (-0.02%)
dist/module.js 165 kB -68 B (-0.04%)
dist/module.no-external.js 164 kB -67 B (-0.04%)
ℹ️ View Unchanged
Filename Size
dist/all-external-dependencies.js 191 kB
dist/exception-autocapture.js 10.5 kB
dist/external-scripts-loader.js 2.35 kB
dist/recorder-v2.js 111 kB
dist/recorder.js 111 kB
dist/surveys-preview.js 59.8 kB
dist/surveys.js 66 kB
dist/tracing-headers.js 8.36 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants