Skip to content

si-timepicker should show PM meridian for noon when Date object is 12:xx #1886

@spliffone

Description

@spliffone

Prerequisites

  • I have read the Contributing Guidelines.
  • I have not leaked any internal/restricted information like screenshots, videos, code snippets, links etc.

Affected component

No response

Summary

When a time with hours equal to 12 (noon) is written to the SiTimepickerComponent — for example 12:30 PM — the meridian <select> incorrectly displays AM instead of PM.

Version

@siemens/element-ng@48.11.0

Steps to reproduce

  1. Use SiTimepickerComponent with a 12-hour clock locale or showMeridian="true".
  2. Set the control value to any time between 12:00 and 12:59 in 24-hour format (i.e. noon through 12:59 PM).
  3. Observe the meridian <select>.

What is the current bug behavior

In updateUI(), the condition used to determine the meridian from a 24-hour hours value was off-by-one:

// Before (wrong) — noon (hours === 12) evaluates to false → 'am'
this.meridian.set(hours > 12 ? 'pm' : 'am');

What is the expected correct behavior

24h hours 12h display Expected meridian
0 12:00 AM (midnight) AM
1–11 1–11 AM AM
12 12:00 PM (noon) PM
13–23 1–11 PM PM
// After (correct) — noon (hours === 12) evaluates to true → 'pm'
this.meridian.set(hours >= 12 ? 'pm' : 'am');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions