Editor Datetime field (12 hour format), 12th hour fix

Editor Datetime field (12 hour format), 12th hour fix

WCGPR0WCGPR0 Posts: 4Questions: 3Answers: 0
edited June 2020 in Free community support

Hello,

I'm not sure if this is intentionally designed this way, but on the /examples/dates/time.html, on the 12 hour datetime format field (Shift start), when you click on the 12th hour, it flips your current selection of PM/AM to AM/PM respectively, and it clears out your selection (the 12th hour doesn't get selected) - although it does update the value correctly (with the AM/PM flipped, so correctly if it's designed that way, but in my case, incorrectly as I wasn't hoping for it to do that).

If this is a bug, how would I go about submitting this a bug fix? Or if it's intended this way, how would I go about adding in a quick fix, so that it will not flip the PM to AM or vice versa, and not clear out the 12th hour selection.

In other words, do not do anything special on the 12th hour?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin
    Answer ✓

    Thanks for letting me know about that - no it wasn't intentional and is quite counter intuitive as a UI (although makes sense from the code view :)).

    I've committed a fix and it will be in Editor 1.9.5. Until then, if you want to patch a local copy, in your Editor code search for the comment "Shift the value for PM" and replace that if block with:

                if ( count === 12 && typeof value === 'number' ) {
                    if (val >= 12 ) {
                        value += 12;
                    }
    
                    if (value == 12) {
                        value = 0;
                    }
                    else if (value == 24) {
                        value = 12;
                    }
                }
    

    That will do the job.

    Allan

This discussion has been closed.