Updated cloudcare's date format to be more universal #35872
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Product Description
A bug was preventing Norwegian-locale users from entering dates into CloudCare. This PR updates the date format to better accommodate non-US dates by changing the date format to be ISO-standard.
The new screen looks like:

where the expected date is represented as 'YYYY-MM-DD'. The previous format was 'M/D/YYYY'. While we could have fixed the bug by using the previous 'M/D/YYYY' format, we felt it would be confusing to non-US users not being able to determine which number was month and which was day. By following the ISO format, there shouldn't be that ambiguity.
Technical Summary
Associated ticket: https://dimagi.atlassian.net/browse/SAAS-15933
The basic issue is that, while the 'tokens' within our date template get localized, the format itself does not. TempusDominus treats
'M'
slightly different from'MM'
.'M'
is put through formatter, which uses the standardIntl
library to convert the month into a localized number. It is this library that is responsible for appending the extra period to the month, so there's not much we can do about that while using'M'
. However, if we use'MM'
, the issue goes away, as the output of that does not include the extra period. While we could fix the issue by changing our current format ofM/D/YYYY
toMM/DD/YYYY
, it felt cleaner to switch to the ISO standard.Random things to point out:
Feature Flag
No feature flag
Safety Assurance
Verified locally that this fixes the Norwegian date issue while still supporting other locales.
Safety story
As mentioned above, this was locally tested. I verified that the form data was still represented correctly on the backend. I also checked the mobile app to make sure we weren't introducing a non-standard change.
I would like to verify that this new date format doesn't break any of the few other places in the code that use it.
Automated test coverage
No automated tests
QA Plan
QA shouldn't be necessary provided we verify the other locations that leverage this date format.
Rollback instructions
Labels & Review