dhis2 / aggregate-data-entry-app

Data entry app for DHIS 2
https://dhis2-data-entry.netlify.app
BSD 3-Clause "New" or "Revised" License
3 stars 3 forks source link

fix: support non-gregory calendars [DHIS2-17617] #397

Closed tomzemp closed 1 week ago

tomzemp commented 1 month ago

Background

This PR adds periods for non-Gregory calendars and updates the date logic throughout the app such that non-Gregorian dates "work" throughout the app to the extent that we can avoid logic problems when working with non-ISO dates.

image

This addresses the following tickets:

Additionally the following will be fixed by this PR:

Some common themes

Period generation

Avoiding use of Date()

date manipulation

Handling time zones

for example:

image

To-do : https://dhis2.atlassian.net/browse/LIBS-693

relative time

_for example:_ gregory:

image

ethiopian:

image

To-do: https://dhis2.atlassian.net/browse/LIBS-691

Testing

I have primarily tested with automated testing by trying to add/expand coverage for any code that is affected by these changes. I have done some light manual testing (e.g. checked that the period generation works okay and that data entry seems to work). It's a bit hard to test some of these things manually as the

dhis2-bot commented 1 month ago

🚀 Deployed on https://pr-397--dhis2-data-entry.netlify.app

tomzemp commented 1 week ago

UPDATE: I spoke with Jan B and he clarified that datetime stamps on the backend are (at least going forward) supposed to be stored and returned in ISO and that the front-end would have responsibility for displaying them in the system's calendar.

Since we have period start/end dates in the non-gregorian calendars, we need to, for example, compare dates between calendars (e.g. check that the org unit closing date (ISO) is after the period end date (ethiopian)).

This also means that some of the assumptions I had about relative time and displaying date/time stamps were not appropriate. I've gone through and refactored and made use of the conversion functions from the multi-calendar-dates conversion functions, so with the most recent commit, there should no longer be anything that is "to do" for non-gregory calendars. I've also created a component DateText to allow us to pass a date stamp and then isolate all the logic for conversion/formatting (I've also added the useTimeZoneConversion hook in that component to correct time differences).

dhis2-bot commented 1 week ago

:tada: This PR is included in version 100.8.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: