When the first advance is updated to 2022-04-01, it updates correctly, as seen from the Network pane, but the list view endpoint returns the previous day.
Implementation
Issue is caused by how Sequelize handles "DATEONLY" fields. When not using a non-UTC timezone the dateonly fields are cast to the local timezone on data retrieval. The solution is to switch production node environment timezone to UTC.
Testing Instructions
Edit the docker-compose.development.yaml and set the TZ value to "America/Whitehorse"
Create or save a new payment with the Payment Date set to 2023-04-01.
Note that while the payment looks correct after saving, if you reload the page it will reveal the bug as the Payment Date is then converted to 2023-03-31 - immediately upon retrieval from the database.
Now repeat the steps with the TZ set to UTC and the Payment Date will no longer be cast back a day.
Fixes https://yg-hpw.atlassian.net/browse/ELCC-50
Relates to:
Context
See https://elcc.ynet.gov.yk.ca/child-care-centres/2/2022-23/summary/payments
When the first advance is updated to 2022-04-01, it updates correctly, as seen from the Network pane, but the list view endpoint returns the previous day.
Implementation
Issue is caused by how Sequelize handles "DATEONLY" fields. When not using a non-UTC timezone the dateonly fields are cast to the local timezone on data retrieval. The solution is to switch production node environment timezone to UTC.
Testing Instructions
docker-compose.development.yaml
and set the TZ value to"America/Whitehorse"
dev up
2023-04-01
.2023-03-31
- immediately upon retrieval from the database.UTC
and the Payment Date will no longer be cast back a day.