Unleash/unleash

Missing date/time culture on strategy contraints

HenrikBacher opened this issue ยท 5 comments

Describe the bug

Date/time formatting configured on the profile page doesn't apply when selecting datetime as a constraint on a strategy

Steps to reproduce the bug

  1. Go to profil page
  2. In date/time formatting drop dop select "da-dk"
  3. Go to a feature and open the "add strategy" dialog
  4. Add a contraint using the context field "currentTime"

Date is shown in the format MM/DD/YYYY hh:mm [AM/PM]

Expected behavior

Expected result would be date presented using danish localization DD/MM/YYYYY HH:mm (24 hour clock)

Logs, error output, etc.

No response

Screenshots

image

Additional context

No response

Unleash version

5.4.1

Subscription type

Enterprise

Hosting type

Self-hosted

SDK information (language and version)

No response

Hey! You're right! This sounds like something we should look into. Thanks for reporting it; I'll have a look next week ๐Ÿ˜„

Hey, @HenrikBacher ๐Ÿ‘‹๐Ÿผ I've had a look at this now, and unfortunately, changing it is not as easy as I'd hoped. We use the native HTML <input type="datetime-local"> element which displays the date time "formatted according to the user's locale as reported by their operating system" (according to MDN). There are no controls to override this.

I would guess that your OS reports an en-US format (mine does, at least)?

Because changing it isn't as simple as adding another HTML attribute but seems to require finding / building a custom component, we would probably put it in as a feature request and prioritize it for later.

I'll dig a little more to see what I can find or to see if we have other quick solutions. I'll let you know if I find something.

Correct, my OS is en-US. UX wise I would that to be the default selection or fallback to en-US, but if able to override that setting on the profile page. I should be possible using a javascript function for the dropdown: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

I should be possible using a javascript function for the dropdown: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

Just wanna check that we're on the same page: yes, you can use toLocaleDateString to format dates to a locale in JS. However, I don't think the input element provides you with a way to format how the selected date is displayed.

That said, I might be wrong. If you know of a way to apply display formatting on the input element, I'd be very happy to use that ๐Ÿ˜„

Closing because of inactivity