Closed tomzemp closed 1 week ago
🚀 Deployed on https://pr-397--dhis2-data-entry.netlify.app
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).
:tada: This PR is included in version 100.8.3 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
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.
This addresses the following tickets:
Additionally the following will be fixed by this PR:
pt_BR
where java code is invalid format (due to amendment in multi-calendar-dates)Some common themes
Period generation
Avoiding use of Date()
date manipulation
Handling time zones
new Date()
) and needed to compare it with a server date. This is now not necessary as we can make use of multi-calendar-datesgetNowInCalendar
and then get a date/time string that reflects the wall clock time for the server. This allows us to refactor to remove a lot of code we had in the app for this.for example:
To-do : https://dhis2.atlassian.net/browse/LIBS-693
relative time
last updated 2016-13-03
instead oflast updated 5 minutes ago
with non ISO calendars)._for example:_ gregory:
ethiopian:
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