Annoying issue using uidatepicker

7 visualizzazioni (ultimi 30 giorni)
Hi
I'm facing an issue with the behavior from uidatepicker. I'm setting uidatepicker with
hDatePicker.DisplayFormat = 'dd-MMM-yyyy';
however this annoying tooltip keeps appearing
although after clicking away from focus, it sets to gracefully to
which is the format I'm asking it to follow from the get go. Think this is due to the LOCALE, which in my machine is en_US (hence why in the first case it insists in displaying it as MM-dd-yyyy) but there seems to be no way to change the locale such that the resulting application (compiled with application compiler) behaves consistently.
Any ideas?
  2 Commenti
Eduardo Salazar
Eduardo Salazar il 21 Set 2021
Bump anyone?
The Q is this: although DisplayFormat has been set as 'dd-MMM-yyyy' it seems to revert to the locale format as default (ignores DisplayFormat altogether). Once the date is loaded in, it shows it as requested. In the process, it shows an "I" (information) message "reminding" me about the locale format, that I'm trying to override.
uidatepicker seems not to have a locale setting. If this is used for a compiled app, my idea is for it to basically obey the format issued as DisplayFormat (regardless of the locale of the machine the app is being used).
Any ideas?

Accedi per commentare.

Risposta accettata

Amanda Irving
Amanda Irving il 14 Ott 2021
Eduardo,
The uidatepicker currently does not accept alpha characters as input. The idea is that not all end users will understand the local language and be able to easily substitute 'Feb' for 'Sep'. It caters towards the requirement that the user shouldn't be required to understand the language the date picker is using to successfully type a date.
You are right, when the DisplayFormat contains alpha characters, the input format defaults to a locale specific default supported by MATLAB's datetime object (English, Korean, Chinese, or Japanese).
If you change the DisplayFormat to include only numeric values, the input format will be consistent with the display format. Maybe that would help, but maybe that would make the date harder to distinguish across Europe and US conventions since the abbreviation for the month will no longer be spelled out.
d = uidatepicker();
d.DisplayFormat = 'MM/dd/yyyy';
Either way, you will get the tooltip. It's intending to remind the user what the format of the input is while they are typing.
What is the inconsistency you are seeing when deploying the app across locales?
  2 Commenti
Eduardo Salazar
Eduardo Salazar il 3 Gen 2022
Modificato: Eduardo Salazar il 3 Gen 2022
Thank you and apologies for the delay in acknowledging your reply. Changing the format to dd-mm-yyyy (removing alpha characters in the display format) did the trick. It was a simple solution in the end; perhaps worth acknowledging that in the documentation? Many thanks again.
Alexander Kramlich
Alexander Kramlich il 22 Gen 2024
Didn't do the trick for me.
Is there a way to get a rid of this annoying tooltip altogether?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Entering Commands in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by