Ignore:
Timestamp:
2011-06-30T15:01:00+02:00 (13 years ago)
Author:
boman
Message:

small fix to the 12 hour clock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/OpeningHoursEditor/src/org/openstreetmap/josm/plugins/ohe/OpeningTimeUtils.java

    r26215 r26219  
    211211    }
    212212
     213    /**
     214     * @param minutes integer in range from 0 and 24*60 inclusive
     215     * @param hourMode 12 or 24 hour clock
     216     * @param showPeriod if 12 hour clock is chosen, the "AM"/"PM" will be shown
     217     * @return a formatted string of the time (for example "01:45 PM" or "13:45")
     218     */
    213219    public static String timeString(int minutes, ClockSystem hourMode, boolean showPeriod) {
    214220        int h = minutes / 60;
    215221        String period = "";
    216222        if (hourMode == ClockSystem.TWELVE_HOURS) {
    217             if (showPeriod) {
    218                 period = h <= 12 ? " AM" : " PM";
    219             }
    220             h %= 12;
    221             if (h == 0) {
    222                 h = 12;
     223            if (h == 24)
     224                return "midnight";
     225            else {
     226                if (showPeriod) {
     227                    period = h < 12 ? " AM" : " PM";
     228                }
     229                h %= 12;
     230                if (h == 0) {
     231                    h = 12;
     232                }
    223233            }
    224234        }
Note: See TracChangeset for help on using the changeset viewer.