flatpickr icon indicating copy to clipboard operation
flatpickr copied to clipboard

Time select does not work correctly in 4.6.10 with altInput

Open kkrasnobayev opened this issue 2 years ago • 15 comments

Hi, noticed that in the latest version hour, minute and second pickers don't work correctly with the following options (for example): { altFormat: "n/j/Y H:i:S" altInput: true dateFormat: "Y-m-d H:i:S" }

Instead of switching hours, minutes, seconds it switches years

kkrasnobayev avatar Mar 07 '22 16:03 kkrasnobayev

Indeed.

crewone avatar Mar 08 '22 08:03 crewone

I can confirm I'm also getting this (or something very similar, depending on altFormat).

{
    altInput: true,
    altFormat: 'd/m/Y H:i',
    dateFormat: 'Y-m-d H:i',
    enableTime: true,
    time_24hr: true,
    locale: {
        firstDayOfWeek: 1
    }
},

Muffinman avatar Mar 08 '22 12:03 Muffinman

Also can confirm the issue. When selecting a future date the datepicker reverts to 2/2/2022.

$(function() {
    $(".datetimepicker").flatpickr({
        enableTime: true,
        minuteIncrement: 1,
        dateFormat: "m/d/Y H:i",
        altInput: true
    });
});

Commenting out the althInput: true option allows one to pick a date in the future without it reverting.

captnord avatar Mar 08 '22 15:03 captnord

Same here, tagging a me too so i can tell people when its fixed, Hope there is a fix ASAP for this...

ClevelyDynamic avatar Mar 08 '22 17:03 ClevelyDynamic

Hello, The problem is whenever the order of the date segments in "altFormat" is different than the one defined in "dateFormat".

`{ altInput: true, altFormat: 'Y/m/d H:i', dateFormat: 'Y-m-d H:i', enableTime: true, } // is OK

{ altInput: true, altFormat: 'd-m-Y H:i', dateFormat: 'Y-m-d H:i', enableTime: true, } // is ERROR

`

libor-sebek avatar Mar 08 '22 17:03 libor-sebek

With this configuration, increasing or decreasing the hour picker increases or decreases the month.

{ altInput: true, enableTime: true, dateFormat: 'Y-m-d H:i', disableMobile: true, allowInput: true }

chrond avatar Mar 08 '22 17:03 chrond

Agreed, this is a significant departure in previously existing functionality

chris-oswald avatar Mar 09 '22 02:03 chris-oswald

This should be a critical bug imho

dantefff avatar Mar 09 '22 09:03 dantefff

I ran into this as well and reverted to 4.6.9 since 4.6.10 broke major portions of my app and flooded my support inbox.

gkilwein avatar Mar 09 '22 14:03 gkilwein

I ran into this as well and reverted to 4.6.9 since 4.6.10 broke major portions of my app and flooded my support inbox.

This is slamming us as well. I am new to NPM can you tell me how you forced it to stick with 4.6.9?

streamingsystems avatar Mar 09 '22 18:03 streamingsystems

I am experiencing these same problems with my configuration:

{ altInput: true, altFormat: "M-d-Y, H:i:S", dateFormat: "U", enableTime: true, enableSeconds: true, maxDate: "today", time_24hr: true }

It seems to work if the altFormat and dateFormat are matching but I get this error if they do not match (which is what I need):

flatpickr:2 Error: Invalid date provided: Mar-02-2022, 00:00:00 at Object.parseDate (flatpickr:2:8100) at _ (flatpickr:2:10934) at HTMLDocument.X (flatpickr:2:20851)

csanders7070 avatar Mar 09 '22 18:03 csanders7070

@streamingsystems I'm not using NPM -- just directly included the following lines of code into my HTML:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

It's the @4.6.9 on the end of the script tag URL that worked for me. It previously was <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script> which is the broken version as of the time I write this comment (version 4.6.10 isn't working for me).

gkilwein avatar Mar 09 '22 19:03 gkilwein

For now I am just capturing the value of the field I want to be changed on output before it gets submitted and converting the string directly using Date objects. This feels pretty hacky though...

csanders7070 avatar Mar 09 '22 19:03 csanders7070

This should be the same one as #2653, and will be addressed by #2662.

mshibuya avatar Mar 12 '22 10:03 mshibuya

Hi guys,

v4.6.11 is out with a fix. Thanks for reporting

chmln avatar Mar 12 '22 20:03 chmln