Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Good catch. Easy fix:

    // Preserve 2400h time by changing leading zeros to 24.
    time = time.replace( /^0*[0:]/, '24' );


> Easy fix:

That converts "0800" into "00:00AM".


True enough, the regex was overzealous. This looks better:

    time = time.replace( /^0*(0:)+/, '24' );




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: