opengovsg / checkfirst

Don't Know? CheckFirst. A tool to build eligibility checkers and calculators for Singapore Government policies
https://checkfirst.gov.sg
Other
12 stars 6 forks source link

fix: set default date to midnight #1254

Closed prestonlimlianjie closed 2 years ago

prestonlimlianjie commented 2 years ago

Problem

This PR fixes a bug that makes calculations involving date field produce inconsistent results.

Closes https://github.com/opengovsg/checkfirst/issues/1253

Solution

This PR sets the default values for the datefield component to be at midnight of the displayed date. The fix is applied to two places

Before & After Videos

BEFORE:

https://user-images.githubusercontent.com/19917616/154448271-cbf0e481-acc2-487f-aaaa-24944651c265.mov

AFTER:

https://user-images.githubusercontent.com/19917616/154448261-5b25b03f-4e24-493b-b3dd-84bff8c8e79e.mov

Tests

3 tests described in https://github.com/opengovsg/checkfirst/issues/1253