Getting Javascript Components to obey Globally Defined Date Formats

ui
date-format
Tags: #<Tag:0x00007efd1a757038> #<Tag:0x00007efd1a756e80>

(Stephen Senkomago Musoke) #1

As we move towards using Javascript components, I would like to kickstart a discussion on getting the components do obey globally defined date formats, in the global properties uiframework.formatter.dateFormat and uiframework.formatter.dateAndTimeFormat

While these are Java dates, I think its okay to define a Javascript date format if the need arises due to incompatibility

The dates are currently hard-coded with an example in this ticket for appointment scheduling ui https://issues.openmrs.org/browse/RA-1561

@mogoodrich How is this being handled in the react-components?

@dkayiwa Do you have any suggestions based on your work with @Andela team?


(Mark Goodrich) #2

It’s not being handled particularly well in react-components… right now have a “dateFormat” util method so that we don’t hard it everywhere, but in the util method that date is hardcoded:

I do agree that this method should be expanded so that it used the date format defined as a global property.

I do, unfortunately, think we need new global properties to handle the JavaScript date format… I don’t think we can multiple-purpose uiframework.formatter.dateFormat, because I know we’ve had need to have both a Java and JavaScript date format definited.

Tangentially, before we did this in react-components I want to create a react-components “global property store” so that the formatDate method doesn’t need to fetch the GP every time it formats a date!

Take care, Mark