-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
The ISO 8601 standard allows to use Weeks but not combining them with other units.
The current implementation of the new browser Date API Temporal allows weeks to be combined with other units.
Example Duration P1W
fontoxpath/src/expressions/dataTypes/valueTypes/DayTimeDuration.ts
Lines 94 to 109 in d5ac004
| DayTimeDuration.fromString = (dayTimeDurationString: string): DayTimeDuration | null => { | |
| const regex = /^(-)?P(\d+Y)?(\d+M)?(\d+D)?(?:T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/; | |
| const match = regex.exec(dayTimeDurationString); | |
| if (!match) { | |
| return null; | |
| } | |
| const isPositive = !match[1]; | |
| const days = match[4] ? parseInt(match[4], 10) : 0; | |
| const hours = match[5] ? parseInt(match[5], 10) : 0; | |
| const minutes = match[6] ? parseInt(match[6], 10) : 0; | |
| const seconds = match[7] ? parseInt(match[7], 10) : 0; | |
| const secondFraction = match[8] ? parseFloat(match[8]) : 0; | |
| return DayTimeDuration.fromParts(days, hours, minutes, seconds, secondFraction, isPositive); |
Metadata
Metadata
Assignees
Labels
No labels