Giter Site home page Giter Site logo

Comments (5)

johngreep avatar johngreep commented on May 24, 2024

The line to determine am/pm doesn't work. I changed it to this and it works fine:
this.amOrPm = this.hours > 12 || period === 'pm' ? 'PM' : 'AM';

from clockpicker.

cepm-nate avatar cepm-nate commented on May 24, 2024

Even after I made the corrections above, we were still having problems if they picked 12. Did they mean noon or midnight?

And after reading this http://www.simplecodeworks.com/IQ/midnight.html, I decided to switch to the 24 hour clock.

Seriously, go read it! :-)

from clockpicker.

mattcasey avatar mattcasey commented on May 24, 2024

This is the code that works for me, replacing https://github.com/weareoutman/clockpicker/blob/gh-pages/src/clockpicker.js#L679:

        if (this.options.twelvehour) {
            if (this.input.attr('type') === 'time') {
                var hoursInMilitary = (this.amOrPm === 'PM') ? this.hours + 12 : this.hours;
                value = leadingZero(hoursInMilitary) + ':' + leadingZero(this.minutes);
                value = value + ':00';
            }
            else {
                value = value + this.amOrPm;
            }
        }

from clockpicker.

rain01 avatar rain01 commented on May 24, 2024

I have the same problem... I don't want to edit the source though... I'll just use type=text for now.

from clockpicker.

pok81694 avatar pok81694 commented on May 24, 2024

Puedes editar las siguientes lineas
https://github.com/weareoutman/clockpicker/blob/gh-pages/src/clockpicker.js#L465

`       this.hours = +value[0] || 0;
        if (this.options.twelvehour) {
            this.minutes = +value[1].split(' ')[0] || 0;
            this.amOrPm = +value[1].split(' ')[1] || 'AM';
        } else {
            this.minutes = +value[1] || 0;
        }
        this.spanHours.html(leadingZero(this.hours));
        this.spanMinutes.html(leadingZero(this.minutes));
        if (this.options.twelvehour) {
            this.spanAmPm.html(' ' + this.amOrPm);
        }

`

from clockpicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.