Annoying issue using uidatepicker

조회 수: 8 (최근 30일)
Eduardo Salazar
Eduardo Salazar 2021년 9월 19일
댓글: Alexander Kramlich 2024년 1월 22일
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
Eduardo Salazar
Eduardo Salazar 2021년 9월 21일
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?
Eduardo Salazar
Eduardo Salazar 2021년 10월 5일
No one knows?

댓글을 달려면 로그인하십시오.

채택된 답변

Amanda Irving
Amanda Irving 2021년 10월 14일
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
Eduardo Salazar
Eduardo Salazar 2022년 1월 3일
편집: Eduardo Salazar 2022년 1월 3일
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 2024년 1월 22일
Didn't do the trick for me.
Is there a way to get a rid of this annoying tooltip altogether?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by