export function convertNotation()

in fuse-ui-fabric/timePicker/timePicker.tsx [157:171]


export function convertNotation(time: ClockTime, notation: TimeNotation): ClockTime {
  if (time.notation === notation) {
    return time;
  }

  if (notation === TimeNotation.AM && time.hour > 12) {
    return { ...time, hour: time.hour - 12, notation };
  }

  if (notation === TimeNotation.PM && time.notation === TimeNotation.D24H && time.hour > 12) {
    return { hour: time.hour - 12, minute: time.minute, notation };
  }

  return { ...time, notation };
}