Clear Filters
Clear Filters

Annoying issue using uidatepicker

5 views (last 30 days)
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 Comments
Eduardo Salazar
Eduardo Salazar on 21 Sep 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?

Sign in to comment.

Accepted Answer

Amanda Irving
Amanda Irving on 14 Oct 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 Comments
Eduardo Salazar
Eduardo Salazar on 3 Jan 2022
Edited: Eduardo Salazar on 3 Jan 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 on 22 Jan 2024
Didn't do the trick for me.
Is there a way to get a rid of this annoying tooltip altogether?

Sign in to comment.

More Answers (0)

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!