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:
- Use `Intl.DateTimeFormat` with the configured locale
- Accept a `use24Hour` option from config
- Delegate to core's `DateUtils.formatTime()`
Files
- `src/renderers/BaseViewRenderer.js:101-105` (formatHour)
- `src/renderers/BaseViewRenderer.js:112-120` (formatTime)
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
Expected Fix
Use the locale from StateManager config and either:
Files