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

Zero out time in GTFS date string conversions #10

Conversation

cedarbaum
Copy link
Contributor

@cedarbaum cedarbaum commented Oct 27, 2023

Avoid local timezone issues when converting GTFS date strings to/from JS dates by zeroing out the HH:MM:SS portion of the date in getDateFromGTFSString. This forces the date object to be created with respect to the machine's local timezone. Prior to this change, the toGTFSDate test would fail when running on a machine in EDT, since the date object for 20190604 would become 20190603 due to the time offset.

Specific changes:

  • Rename toGTFSDate and corresponding spec file to gtfsDateUtils
  • Extract getDateFromGTFSString to an external function in gtfsDateUtils
  • Zero out time in getDateFromGTFSString
  • Add additional unit tests

@cedarbaum cedarbaum force-pushed the zero_out_time_in_gtfs_date_conversion branch from 14a5c48 to d2e2032 Compare October 27, 2023 21:46
@linusnorton linusnorton merged commit 3ee3e97 into planarnetwork:master Oct 28, 2023
@linusnorton
Copy link
Contributor

Thanks @cedarbaum this has been released in version 2.1.1

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

Successfully merging this pull request may close these issues.

None yet

2 participants