Closed ghost closed 3 years ago
Possibly related: https://github.com/medic/cht-core/issues/4681
@ashish-medic I think this probably also applies to other places in the app that dates are shown, for example, task due dates (on hover), and dates in the contact summary section. Can you confirm this is the case? Should these be converted to Bikram Sambat as well?
This issue must be resolved as soon as possible because the delivery date with NSSD is September 15th, 2021, and the government is planning to deploy immediately after that. It would be a disappointment if we are unable to deliver the product on time. Thank you in advance for your assistance.
@ashish-medic @nnbhandari1 @binokaryg
@garethbowen thanks for bringing task due dates, and the contact summary section in pictures. Yes, we need this functionality in tasks and contact summary.
Is this what the Date Filter does in app settings?
https://docs.communityhealthtoolkit.org/apps/reference/app-settings/#date-format-filters
@newtewt Yes but it's not widely used in the app. I think it's available for translation keys but as far as I can tell not within enketo forms and not throughout the app where dates are shown.
It's unusual for us to release a patch with a feature, but it's happened before (coincidentally, it was related, about supporting a new language).
Are we planning to release a patch with this feature, or add it to 3.13
?
@dianabarsan it's kind of debatable if this is a feature or bug really. It's more that it's weird that it doesn't work. Technically the date picker does function and this is about using a different calendar (where you could call it a feature), but for users of this, they don't all understand the Gregorian calendar and how to convert that to the Bikram Sambat they're looking for - showing the Gregorian calendar just doesn't make sense.
Regarding a release plan for it, the intention is to have it merged into master, where the project (not yet live, but needed for a demo deadline) can run off a branch/hash. Completion of this code will not require its own official CHT release.
Im starting work on this today.
First of all, apologies for the screenshot spam. What I got so far:
to-bikram-sambat
which takes a date string parameter and displays the date in Bikram Sambat. Example (in this screenshot, selected language is en
:
The form used: https://gist.github.com/dianabarsan/44fb5231953fd3806c7459fd7d0a9319
ne
, date displays and relative date tooltips in lists are converted to Bikram Sambat: Tasks:
Reports:
Contact detail tasks and reports:
ne
, contact summary date filters automatically convert to Bikram Sambat: Example where the field label is actually the used filter like: contact.<filter>
and the displayed date is contact.reported_date
:
Contact summary fields config:
{ appliesToType: 'person', label: 'contact.dateOfDeath', value: thisContact.reported_date, width: 4, filter: 'dateOfDeath' },
{ appliesToType: 'person', label: 'contact.age', value: thisContact.reported_date, width: 4, filter: 'age' },
{ appliesToType: 'person', label: 'contact.dayMonth', value: thisContact.reported_date, width: 4, filter: 'dayMonth' },
{ appliesToType: 'person', label: 'contact.relativeDate', value: thisContact.reported_date, width: 4, filter: 'relativeDate' },
{ appliesToType: 'person', label: 'contact.relativeDay', value: thisContact.reported_date, width: 4, filter: 'relativeDay' },
{ appliesToType: 'person', label: 'contact.taskDueDate', value: thisContact.reported_date, width: 4, filter: 'taskDueDate' },
{ appliesToType: 'person', label: 'contact.simpleDate', value: thisContact.reported_date, width: 4, filter: 'simpleDate' },
{ appliesToType: 'person', label: 'contact.simpleDateTime', value: thisContact.reported_date, width: 4, filter: 'simpleDateTime' },
{ appliesToType: 'person', label: 'contact.fullDate', value: thisContact.reported_date, width: 4, filter: 'fullDate' },
Changes are available for testing on 7294-bikram-sambat-dates
- it's based off of master
and can be installed with Horticulturalist.
Please share if anything seems out of order or is missing. Thanks!
One of the places where dates are not converted, because there is no mechanism to do so, are when displaying dates in XML report details.
This does work for JSON form fields, when the type is set to date
.
So, for XML forms, if you want a date field displayed in Bikram Sambat in report details, you'd have to use the Enketo calculation described in the above comment.
Hi team, did some testing, and looks good to me. Here are some screenshot
Screenshot of online Nepali calendar :
But for this part
{ appliesToType: 'person', label: 'contact.dayMonth', value: thisContact.reported_date, width: 4, filter: 'dayMonth' },
It only translate.
The branch has been updated to fix this. Right now:
thanks @dianabarsan it's fixed
I'm conflicted about somehting in regards to the implementation of this. Does anyone think it's worth adding a configuration flag that can be used to opt-out of formatting and converting all dates across the app in Bikram Sambat whenever Nepali language is used? Or will all Nepali deployments always want Bikram Sambat dates? I'm looking for some feedback on this. Thanks!
My understanding is native Nepali users will want BS everywhere, but would love confirmation of that from @ashish-medic !
A compromise option would be to show both dates but with limited screen real estate that doesn't feel like a sacrifice we can afford to make.
It was my understanding as well, with the biggest hint that our current Enketo datepicker switches to Bikram Sambat automatically when Nepali is selected.
@garethbowen I second your understanding, yes Nepali users want to understand.
This is ready for AT on 7294-bikram-sambat-dates
Should include conversion date to Bikram Sambat when selected locale is "ne". Should convert:
item list dates (like reported date in reports list, or messages) - this includes the tooltip
report submitted date:
last sync date
contact ages in lists of children:
contact summary fields that use date filters: dateOfDeath, age, dayMonth, relativeDate, relativeDay, simpleDate, simpleDateTime, fullDate:
Does not convert the date filter on the reports page.
Adds a new Enketo xpath function to-bikram-sambat
that converts a gregorian date to Bikram Sambat text.
Example form using the new function: https://gist.github.com/dianabarsan/44fb5231953fd3806c7459fd7d0a9319
Adds a new pipe (filter) localizeNumber
that localizes digits (so far, only converts to Devanagari script), which is now used in many places where we display numbers:
It's possible I may have missed some, also some numbers are part of messageformat
pluralized keys, and passing localized numbers break messageformat
matchers.
The new pipe (filter) can also be used for contact-summary fields to localize them:
Documentation PR pending.
Testing on local
Messages : Dates and tooltips
Tasks :
Reports : date picker report dates and tooltips >>
People /contacts: contact summary
Analytics/Targets
Pinging @ashish-medic and @binokaryg to double check as it is quite hard form me to create new contacts and reports and date with zero knowledge of the language.
I will also check from my side.
@latin-panda I think we can merge this one. We have covered most areas where dates are used. If @ashish-medic and team picks up any issue we overlooked, we can open another ticket.
Thanks Bede! I'll wait for @dianabarsan to come back before merging.
Merged to master
.
Is your feature request related to a problem? Please describe. In CHT, date-picker is converted in Nepali date (Bikram Sambat) when we change the language into Nepali, but when we try to display the enter data, it shows the gregorian date. I have tried using bikram-sambat tag in appearance, it only translated English to Nepali and does convert the date.
Describe the solution you'd like
So requesting for date conversion function or a tag in app form, so that date can be shown in summary and notes
@lalkunwar @niraj21