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

No error if you pass in timestamped date with a timezone #416

Open
eipark opened this issue Sep 23, 2024 · 2 comments
Open

No error if you pass in timestamped date with a timezone #416

eipark opened this issue Sep 23, 2024 · 2 comments
Labels

Comments

@eipark
Copy link

eipark commented Sep 23, 2024

I incorrectly was trying to do something like:

spacetime('2024-09-23T16:15:12.519+00:00', 'America/New_York') thinking it would adjust this timestamp to my timezone.

Ultimately, what I wanted was spacetime('2024-09-23T16:15:12.519+00:00').goto("America/New_York").

It feels like the first call should throw an error of some sort if you pass in a timezone when one is already specified?

@spencermountain
Copy link
Owner

hey Ernie, ya - you're right about this being a really weak part of the library, and a source of confusion for me as well.
I'm welcome to ideas for fixing it, or clarifying the situation in the docs.

I have considered requiring a tz as a 2nd param, but in so many cases, people are working locally, and don't want to think about timezones.

ya - if you pass an offset in the ISO string, it tries to guess which IANA it should be. The confusion comes from this implicit IANA. it's not an error, because it's a valid use-case. We also can't introduce a breaking change, without a major version, which I want to avoid.

let me know if you have any ideas
cheers

@eipark
Copy link
Author

eipark commented Sep 23, 2024

Understood. Yeah not too sure about the internals here, but maybe just a console.warning if you pass in a string with a timezone plus a timezone? "Passed in timezone will be ignored, being inferred from ISO string with offset" something like that.

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

No branches or pull requests

2 participants