Closed colincadams closed 3 years ago
@colincadams for testing with static times or timezones, have you looked at the timekeeper
package? We use it in some of our other frontend projects via import tk from "timekeeper";
I've noticed tests failing in generateHint.js
and decided to unify the date format to do not use the Date js class at all, as we use only UTC dates and should not depend on timezones.
Description of the change
For #55 there were a few underlying issues:
dateReported
is constructed withnew Date("2020-11-30")
which uses no timezone offset when constructing it. Then we printed it using the local timezone which would be "2020-11-29".While I was trouncing around to try to figure out what was happening I figured I would just take a stab at fixing the first two to get more familiar with what is happening in JS land. If this feels reasonable, great, if not feel free to abandon this PR and take a different approach.
I added a test for the (2), but didn't see an easy way to mock the timezone to test (1). If there is one let me know! I also fixed the data entry error for (3) separately.
Type of change
Related issues
Closes #55
Checklists
Development
These boxes should be checked by the submitter prior to merging:
Code review
These boxes should be checked by reviewers prior to merging: