Various issues regarding timezones
Opened this issue · 0 comments
Hey there, thanks for your work in setting up this project. I've been eager to use it in some of my projects.
I had a few questions surrounding the usage of the tradingSession
functions. I've been using the new_york
calendar exclusively for these examples.
The tradingSession
and tradingSessions
calls seem to return incorrect results when called with a specific moment.
console.log(calendar.tradingSessions(moment("2020-09-01T16:30:00.000Z")));
console.log(calendar.tradingSessions(moment("Tue, 01 Sep 2020 9:30:00 PDT")));
both yield moments where the start is 2020-09-01T16:30:00.000Z
and the end is 2020-09-01T23:00:00.000Z
, even though the expected UTC times for NYC are 13:30 to 20:00.
Debugging a bit into this, it seems like this is because the sessions are created assuming 9:30am and 4:00pm in the local timezone, which in my case is America/Los_Angeles
. Is there a way to retrieve the correct NYC-based moments for the trading sessions? Or to derive the correct start/end times for GMT-7?
I noticed the setTimezoneHere
method in the documentation, which didn't work correctly out of the package as it isn't attached to the fincal
or calendar
objects. I pulled the method into the calendar export and tried calling calendar.setTimezoneHere("America/Los_Angeles");
before the same lines above with no change.
For the nextTradingSession
function, I noticed that it only supports days and not specific times. Is there any plans to support this or any alternatives? Assuming I can get the first problem figured out I'm also happy to tinker with it.