You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using this method to calculate whether market is open. The problem is it doesn't handle EST vs EDT. Thoughts on adding something more robust to your gem?
classMarketHoursdefself.open?(time=nil)Time.use_zone('Eastern Time (US & Canada)')dotime ||= Time.currentreturnfalseiftime.on_weekend?market_open=Time.zone.local(time.year,time.month,time.day,9,30)market_close=Time.zone.local(time.year,time.month,time.day,16,0)time.between?(market_open,market_close)endendend
The text was updated successfully, but these errors were encountered:
Time zones are tricky. One problem with this is that Time.current is from Rails. I think a gem like this should not need to have Rails as a dependency.
I'm currently using this method to calculate whether market is open. The problem is it doesn't handle EST vs EDT. Thoughts on adding something more robust to your gem?
The text was updated successfully, but these errors were encountered: