I have a time string that I need to convert into a timestamp, but it's in the timezone of another location. The location uses DST, so it isn't as simple as adding some constant offset.
For example, I want to go from
Mar 10, 2024, 06:00:00 (America/Vancouver time)
to
1710075600000.
Date.parse works fine if the user is actually in America/Vancouver, but produces different timestamps if they're in Portugal.
I tried adding the target timezone to the date string, but I wasn't accounting for DST.
Date.parse('Mar 10, 2024, 06:00:00 PST') produces 1710079200000. I should use PDT in this case, but I'm not sure how to check if a future date is in DST in a different timezone.