[IGN-732] Locale for datetime picker on components


I see it's possible to change the locale property in the Date Time Picker:

But I don't see those options for built-in components.

Alarm Journal:

Power Chart:

Maybe there are other components without that property.

Am I missing the way to do it or should we start a request on canny for it?

If I recall correctly, the DateTime components have a locale only because they've been around since before we fully supported locales in Perspective as a whole.

All Perspective components are supposed to be locale-aware now without any configuration on your end, and they all use the locale of the session. If you look at the Session-level properties, you will see props.locale. This property is what all Perspective components tie into. At this point in time, the components which have their own locale property only use that property to override the session locale setting, essentially ignoring the session locale and instead using whatever is supplied in this component-level setting.

If your goal is to override the session setting in those other components, we don't supply a way to do that. The only reason we even kept those locale props on the DateTime components was for backwards-compatibility purposes.


I have been changing the locale for a while now. I don't see those built-in components changing with the locale, that's why a raised the question.

Those screenshots were taken with the locale "nb" in the designer, which don't use AM/PM. What could be preventing it from changing?

I didn't test this, but Designer may not be using the locale. (It's not a full browser.) Test it in a web browser.

Also, are you changing the session locale AND the DateTime component locale? If your session locale is nb, but your DateTime component is still using en, then your DateTime is going to use the en locale and not the browser. Bind DateTimePicker.props.locale against session.props.locale if you always want them to use the session locale.

I'm not testing Date Time Picker, as it is possible to change the locale there. My main focus right now is Power Chart, Alarm Journal, and maybe other components that could also have a built-in date time picker.

I've tested it in Chrome. I've also been using two languages for a while now, that's why it surprises me that it should have changed automatically from the beginning.

Oh, so your question is regarding how to get the components which use any sort of built-in DateTime functionality to use the locale? No, they don't, and we're aware of it, with open internal tickets to bring them in-line with the stand-alone components.

1 Like

I hope it can be done sooner than later. I will start working around components to use the external Date Time Picker while is not ready.