1. factormystic
  2. HUD Time
  3. Issues
Issue #11 new

24 H format

Anonymous created an issue

To change into 24H format, edit gadget.js

When I change it to 24 Hour format and delete the "meridiem" it does not fit anymore to show the underneath month or day...??? How to force more space behind 24H format, even when I do not have the "meridiem"???

toTime = bg.addTextObject('00:00', font, 105, color, 0, 0);

var hours = currentDate.getHours(); var meridiem = hours >= 12 ? ' PM' : ' AM'; if(hours == 0) { hours = 24;


toTime.value = hours > 12 ? (hours-24) + minutes + meridiem : hours + minutes + meridiem; toTime.font = font; toTime.color = color;

Comments (2)

  1. David-Lee Kulsch

    Add some space (i use 80 for example, about 90 is the height of the time displayed)

        toTime.left = targetWidth * dpiScaling - toTime.width - 80;
        toTime.top = 0;
    
    
        toDate.value = currentDate.getDate();
        toDate.font = font;
        toDate.color = color;
        toDate.opacity = opacity;
    
        toDate.left = toTime.left + 80;
    

    dont forget to add the time at toDate left too, else date will begin at same horizontalposition like time

  2. onlymakinganaccounttocomment

    Guys you're making this way more complicated than it is.

    Find this line

    toTime.value = hours > 12 ? (hours-12) + minutes + meridiem : hours + minutes + meridiem;
    

    delete this part

    hours > 12 ? (hours-12) + minutes + meridiem
    

    so it looks like this

    toTime.value = hours + minutes;
    

    and it should show 24 hour time with everything perfectly oriented

  3. Log in to comment