"Date format" formats hours wrong at midnight

Issue #18 resolved
Maarten created an issue

When reaching midnight and you format the time to something like HH-mm, it will tell the time as 24:30 instead of 00:30. From 01:00 it will revert back to logical time formatting.

Comments (10)

  1. arie repo owner

    Okay, someone else has a same kind of issue.

    I will look at this issue tonight, but i only have about 2 hours to solve it ;)

  2. arie repo owner

    Okay, in English, when you request the Hours in a non-12-hour format, you will get 24:xx.

    This is the definition for english.
    I have change this, because it will mess up what people would want!
    Update BLL to resolve this issue!
    And let me know if it works

    To see this, try these 2 codes in HomeyScript:

    let date = new Date();
    date = date.setHours(date.getHours()+5);
    date = new Date(date);
    let a = date.toLocaleString('EN' || this.locale || DateTime.locale, {hour:'2-digit', hour12:false });
    return a;
    

    will return 24
    and then

    let date = new Date();
    date = date.setHours(date.getHours()+5);
    date = new Date(date);
    let a = date.toLocaleString('EN' || this.locale || DateTime.locale, {hour:'2-digit', hourCycle:'h23' });
    return a;
    

    Will return 00

  3. Log in to comment