Skip to content

BaseViewRenderer.renderTimedEvent uses hardcoded 12-hour time format #64

@thedhanawada

Description

@thedhanawada

Description

`BaseViewRenderer.formatTime()` (lines 112-120 in `src/renderers/BaseViewRenderer.js`) and `formatHour()` (lines 101-105) use hardcoded 12-hour AM/PM formatting:

```js
formatTime(date) {
const hours = date.getHours();
const minutes = date.getMinutes();
const period = hours >= 12 ? 'PM' : 'AM';
const displayHour = hours % 12 || 12;
return minutes === 0
? `${displayHour} ${period}`
: `${displayHour}:${minutes.toString().padStart(2, '0')} ${period}`;
}
```

This ignores the `locale` configuration that is available through the StateManager. Many locales (most of Europe, Asia, South America) use 24-hour time format.

Impact

  • Non-US users see unfamiliar time format
  • Inconsistent with core's `DateUtils.formatTime()` which accepts a `use24Hour` parameter
  • Salesforce orgs with international users will display times incorrectly

Expected Fix

Use the locale from StateManager config and either:

  1. Use `Intl.DateTimeFormat` with the configured locale
  2. Accept a `use24Hour` option from config
  3. Delegate to core's `DateUtils.formatTime()`

Files

  • `src/renderers/BaseViewRenderer.js:101-105` (formatHour)
  • `src/renderers/BaseViewRenderer.js:112-120` (formatTime)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions