Skip to content

Conversation

@Lucaka
Copy link

@Lucaka Lucaka commented Feb 14, 2025

PR Description

Problem Encountered:

When assigning a specific date (e.g., value = new Date('2025-02-14')), manually entering a value in a type="time" <DatePicker> component causes the date to reset to today's date.

Reproduction Example:
<DatePicker v-model:value="value" type="date"></DatePicker> 
<DatePicker v-model:value="value" type="time" format="HH:mm"></DatePicker>
  • Expected: The time input should update only the time while preserving the original date (2025-02-14).
  • Actual: The date is reset to today (new Date()).

Solution in This PR:

  • In PickerInput, when handleChange is triggered, we retain the original date while updating only the time.
  • Instead of using parseDate, which resets the date to today, we ensure that only the time portion is modified.
  • This prevents unexpected date resets and ensures consistent behavior across type="time" inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant