mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
feat(datetime): add hourCycle property (#23686)
resolves #23661 Co-authored-by: Liam DeBeasi <liamdebeasi@icloud.com>
This commit is contained in:
@ -318,6 +318,12 @@ export class Datetime implements ComponentInterface {
|
||||
*/
|
||||
@Prop() showDefaultTimeLabel = true;
|
||||
|
||||
/**
|
||||
* The hour cycle of the `ion-datetime`. If no value is set, this is
|
||||
* specified by the current locale.
|
||||
*/
|
||||
@Prop() hourCycle?: 'h23' | 'h12';
|
||||
|
||||
/**
|
||||
* If `cover`, the `ion-datetime` will expand to cover the full width of its container.
|
||||
* If `fixed`, the `ion-datetime` will have a fixed width.
|
||||
@ -1397,9 +1403,10 @@ export class Datetime implements ComponentInterface {
|
||||
* should just be the default segment.
|
||||
*/
|
||||
private renderTime(mode: Mode) {
|
||||
const use24Hour = is24Hour(this.locale);
|
||||
const { hourCycle } = this;
|
||||
const use24Hour = is24Hour(this.locale, hourCycle);
|
||||
const { ampm } = this.workingParts;
|
||||
const { hours, minutes, am, pm } = generateTime(this.locale, this.workingParts, this.minParts, this.maxParts, this.parsedHourValues, this.parsedMinuteValues);
|
||||
const { hours, minutes, am, pm } = generateTime(this.workingParts, use24Hour ? 'h23' : 'h12', this.minParts, this.maxParts, this.parsedHourValues, this.parsedMinuteValues);
|
||||
return (
|
||||
<div class="datetime-time">
|
||||
<div class="time-header">
|
||||
|
||||
Reference in New Issue
Block a user