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: with showTime and hourFormat="24" time hour is set to 00 on day change #5248

Closed
francescods opened this issue Feb 8, 2024 · 5 comments

Comments

@francescods
Copy link

Describe the bug

The calendar does not work properly when used with showTime and hourFormat="24".
When you select a day the hours are set to 00, only with hoursFormat="24"

Reproducer

https://stackblitz.com/edit/primevue-nuxt-issue-template-pfzbwe?file=app.vue

PrimeVue version

3.48.1

Vue version

3.x

Language

TypeScript

Build / Runtime

Nuxt

Browser(s)

All browsers

Steps to reproduce the behavior

Run stackblitz, click on the input calendar and select a day, the hours are always set to 00

Expected behavior

The hours should not be updated to 00

@francescods francescods added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 8, 2024
@mertsincan
Copy link
Member

Thanks a lot for your report! I set a milestone for it. We'll check before the milestone is released.

@mertsincan mertsincan added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 9, 2024
@mertsincan mertsincan added this to the 3.52.0 milestone Feb 9, 2024
@jozefnad
Copy link

jozefnad commented Mar 18, 2024

in Calendar.vue component you should edit this 2 things:

 selectDate(dateMeta) {
            let date = new Date(dateMeta.year, dateMeta.month, dateMeta.day);
            // ADD THESE LINES
           if (this.modelValue) {
                date.setHours(this.modelValue.getHours(), this.modelValue.getMinutes());
            }
            // CONTINUE CODE
            if (this.showTime) { ................

and this:

parseDateTime(text) {
            let date;
            let parts = text.split(' ');

            if (this.timeOnly) {
                date = this.modelValue ? new Date(this.modelValue) : new Date(); //EDIT THIS LINE
                this.populateTime(date, parts[0], parts[1]);
            } else {............

@nunooliveiralopes
Copy link

nunooliveiralopes commented Apr 5, 2024

primevue": "^3.49.1"
After this change and npm run build or npm run dev, this solutions not work.

@jozefnad
Copy link

primevue": "^3.49.1" After this change and npm run build or npm run dev, this solutions not work

you need also to edit all calendar files such as *.esm.js of components you try to edit

@tugcekucukoglu
Copy link
Member

Fixed with: #5620

@tugcekucukoglu tugcekucukoglu removed this from the 3.52.0 milestone Apr 22, 2024
@tugcekucukoglu tugcekucukoglu removed the Status: Pending Review Issue or pull request is being reviewed by Core Team label Apr 22, 2024
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

No branches or pull requests

5 participants