Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar: Overwrites date when in time-only mode #4901

Closed
rstainsby opened this issue Nov 30, 2023 · 1 comment
Closed

Calendar: Overwrites date when in time-only mode #4901

rstainsby opened this issue Nov 30, 2023 · 1 comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@rstainsby
Copy link
Contributor

Describe the bug

When using the calendar component in time-only mode, the date passed to it via v-model is overwritten to new Date(). This causes the model itself to be overwritten and causes unexpected behavior in consuming applications.

This does not occur when the time is changed vie the incremental arrow buttons, it only occurs when inputting a new time via the textbox.

Reproducer

https://codesandbox.io/p/devbox/primevue-calendar-bug-t38fnj?file=%2Fsrc%2FApp.vue%3A15%2C12

PrimeVue version

3.29.2

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to reproduction sandbox
  2. Note datetime displayed
  3. Change time via incremental arrow buttons (note there is no change to date displayed, only the time)
  4. Change time via text box (note that the date changes to today's date)

Expected behavior

Changing time should result in the date staying the same, as it already does when incrementing via the arrow buttons.

@rstainsby rstainsby added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 30, 2023
@rstainsby
Copy link
Contributor Author

rstainsby commented Nov 30, 2023

I've created a pull request with a potential fix #4902.

It's untested, so apologies if I missed something. Hopefully it at least gives you a good starting point!

@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 1, 2023
@tugcekucukoglu tugcekucukoglu added this to the 3.43.0 milestone Dec 1, 2023
tugcekucukoglu added a commit that referenced this issue Dec 1, 2023
#4901 - parse date when in time-only mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants