(style: Intl.DateTimeFormatOptions = { dateStyle: 'medium' })
| 188 | } |
| 189 | |
| 190 | getDateTimeRangeText(style: Intl.DateTimeFormatOptions = { dateStyle: 'medium' }) { |
| 191 | const validFrom = this.from.isValidDate(); |
| 192 | const validTo = this.to.isValidDate(); |
| 193 | if (!validFrom || !validTo) { |
| 194 | const from = validFrom ? this.from.getDateTimeText(style) : '?'; |
| 195 | const to = validTo ? this.to.getDateTimeText(style) : '?'; |
| 196 | return `${from} - ${to}`; |
| 197 | } |
| 198 | return new Intl.DateTimeFormat(this.locale, style).formatRange( |
| 199 | this.from.getDate(), |
| 200 | this.to.getDate(), |
| 201 | ); |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | export class IntlDateTime { |
no test coverage detected