fix: refs #8441 handle blur and focusout events to format date input
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jose Antonio Tubau 2025-04-22 07:49:32 +02:00
parent 83ecfca6b8
commit 31e337c77b
1 changed files with 12 additions and 1 deletions

View File

@ -141,6 +141,16 @@ const formatDate = () => {
textColor.value = '';
};
const didFormat = ref(false);
const handleBlurOrFocusout = (e) => {
if (!didFormat.value) {
formatDate();
didFormat.value = true;
nextTick(() => (didFormat.value = false));
}
};
const handleEnter = (event) => {
formatDate();
@ -170,7 +180,8 @@ const handleEnter = (event) => {
:input-style="{ color: textColor }"
@click="isPopupOpen = !isPopupOpen"
@keydown="isPopupOpen = false"
@blur="formatDate"
@blur="handleBlurOrFocusout"
@focusout="handleBlurOrFocusout"
@keydown.enter.prevent="handleEnter"
hide-bottom-space
:data-cy="($attrs['data-cy'] ?? $attrs.label) + '_inputDate'"