|
| 1 | +{ |
| 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | + "title": "ISO 8601-1:2019 Duration (Designator Format)", |
| 4 | + "description": "A duration in designator format P[n]Y[n]M[n]DT[n]H[n]M[n]S (§5.5.2.2, §5.5.2.3)", |
| 5 | + "$comment": "https://www.iso.org/standard/70907.html", |
| 6 | + "examples": [ |
| 7 | + "P3Y6M4DT12H30M5S", |
| 8 | + "P1Y", |
| 9 | + "PT1H", |
| 10 | + "P1DT1S", |
| 11 | + "P0Y0M0DT0H0M0S", |
| 12 | + "P1.5Y", |
| 13 | + "PT0.5H" |
| 14 | + ], |
| 15 | + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", |
| 16 | + "type": "string", |
| 17 | + "allOf": [ |
| 18 | + { |
| 19 | + "not": { |
| 20 | + "const": "P" |
| 21 | + } |
| 22 | + }, |
| 23 | + { |
| 24 | + "not": { |
| 25 | + "const": "PT" |
| 26 | + } |
| 27 | + } |
| 28 | + ], |
| 29 | + "anyOf": [ |
| 30 | + { |
| 31 | + "$comment": "Date-only: Years with decimal (lowest order)", |
| 32 | + "pattern": "^P[0-9]+(?:\\.[0-9]+)?Y$" |
| 33 | + }, |
| 34 | + { |
| 35 | + "$comment": "Date-only: Years (integer) + Months with decimal (lowest order)", |
| 36 | + "pattern": "^P[0-9]+Y[0-9]+(?:\\.[0-9]+)?M$" |
| 37 | + }, |
| 38 | + { |
| 39 | + "$comment": "Date-only: Years (integer) + Months (integer) + Days with decimal (lowest order)", |
| 40 | + "pattern": "^P[0-9]+Y[0-9]+M[0-9]+(?:\\.[0-9]+)?D$" |
| 41 | + }, |
| 42 | + { |
| 43 | + "$comment": "Date-only: Months with decimal (lowest order)", |
| 44 | + "pattern": "^P[0-9]+(?:\\.[0-9]+)?M$" |
| 45 | + }, |
| 46 | + { |
| 47 | + "$comment": "Date-only: Months (integer) + Days with decimal (lowest order)", |
| 48 | + "pattern": "^P[0-9]+M[0-9]+(?:\\.[0-9]+)?D$" |
| 49 | + }, |
| 50 | + { |
| 51 | + "$comment": "Date-only: Days with decimal (lowest order)", |
| 52 | + "pattern": "^P[0-9]+(?:\\.[0-9]+)?D$" |
| 53 | + }, |
| 54 | + { |
| 55 | + "$comment": "Time-only: Hours with decimal (lowest order)", |
| 56 | + "pattern": "^PT[0-9]+(?:\\.[0-9]+)?H$" |
| 57 | + }, |
| 58 | + { |
| 59 | + "$comment": "Time-only: Hours (integer) + Minutes with decimal (lowest order)", |
| 60 | + "pattern": "^PT[0-9]+H[0-9]+(?:\\.[0-9]+)?M$" |
| 61 | + }, |
| 62 | + { |
| 63 | + "$comment": "Time-only: Hours (integer) + Minutes (integer) + Seconds with decimal (lowest order)", |
| 64 | + "pattern": "^PT[0-9]+H[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 65 | + }, |
| 66 | + { |
| 67 | + "$comment": "Time-only: Minutes with decimal (lowest order)", |
| 68 | + "pattern": "^PT[0-9]+(?:\\.[0-9]+)?M$" |
| 69 | + }, |
| 70 | + { |
| 71 | + "$comment": "Time-only: Minutes (integer) + Seconds with decimal (lowest order)", |
| 72 | + "pattern": "^PT[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 73 | + }, |
| 74 | + { |
| 75 | + "$comment": "Time-only: Seconds with decimal (lowest order)", |
| 76 | + "pattern": "^PT[0-9]+(?:\\.[0-9]+)?S$" |
| 77 | + }, |
| 78 | + { |
| 79 | + "$comment": "Date+Time: Years + Hours with decimal (lowest order)", |
| 80 | + "pattern": "^P[0-9]+YT[0-9]+(?:\\.[0-9]+)?H$" |
| 81 | + }, |
| 82 | + { |
| 83 | + "$comment": "Date+Time: Years + Hours (integer) + Minutes with decimal (lowest order)", |
| 84 | + "pattern": "^P[0-9]+YT[0-9]+H[0-9]+(?:\\.[0-9]+)?M$" |
| 85 | + }, |
| 86 | + { |
| 87 | + "$comment": "Date+Time: Years + Hours (integer) + Minutes (integer) + Seconds with decimal (lowest order)", |
| 88 | + "pattern": "^P[0-9]+YT[0-9]+H[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 89 | + }, |
| 90 | + { |
| 91 | + "$comment": "Date+Time: Years + Minutes with decimal (lowest order)", |
| 92 | + "pattern": "^P[0-9]+YT[0-9]+(?:\\.[0-9]+)?M$" |
| 93 | + }, |
| 94 | + { |
| 95 | + "$comment": "Date+Time: Years + Minutes (integer) + Seconds with decimal (lowest order)", |
| 96 | + "pattern": "^P[0-9]+YT[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 97 | + }, |
| 98 | + { |
| 99 | + "$comment": "Date+Time: Years + Seconds with decimal (lowest order)", |
| 100 | + "pattern": "^P[0-9]+YT[0-9]+(?:\\.[0-9]+)?S$" |
| 101 | + }, |
| 102 | + { |
| 103 | + "$comment": "Date+Time: Years (integer) + Months + Hours with decimal (lowest order)", |
| 104 | + "pattern": "^P[0-9]+Y[0-9]+MT[0-9]+(?:\\.[0-9]+)?H$" |
| 105 | + }, |
| 106 | + { |
| 107 | + "$comment": "Date+Time: Years (integer) + Months + Hours (integer) + Minutes with decimal (lowest order)", |
| 108 | + "pattern": "^P[0-9]+Y[0-9]+MT[0-9]+H[0-9]+(?:\\.[0-9]+)?M$" |
| 109 | + }, |
| 110 | + { |
| 111 | + "$comment": "Date+Time: Years (integer) + Months + Hours (integer) + Minutes (integer) + Seconds with decimal (lowest order)", |
| 112 | + "pattern": "^P[0-9]+Y[0-9]+MT[0-9]+H[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 113 | + }, |
| 114 | + { |
| 115 | + "$comment": "Date+Time: Years (integer) + Months + Minutes with decimal (lowest order)", |
| 116 | + "pattern": "^P[0-9]+Y[0-9]+MT[0-9]+(?:\\.[0-9]+)?M$" |
| 117 | + }, |
| 118 | + { |
| 119 | + "$comment": "Date+Time: Years (integer) + Months + Minutes (integer) + Seconds with decimal (lowest order)", |
| 120 | + "pattern": "^P[0-9]+Y[0-9]+MT[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 121 | + }, |
| 122 | + { |
| 123 | + "$comment": "Date+Time: Years (integer) + Months + Seconds with decimal (lowest order)", |
| 124 | + "pattern": "^P[0-9]+Y[0-9]+MT[0-9]+(?:\\.[0-9]+)?S$" |
| 125 | + }, |
| 126 | + { |
| 127 | + "$comment": "Date+Time: Years (integer) + Months (integer) + Days + Hours with decimal (lowest order)", |
| 128 | + "pattern": "^P[0-9]+Y[0-9]+M[0-9]+DT[0-9]+(?:\\.[0-9]+)?H$" |
| 129 | + }, |
| 130 | + { |
| 131 | + "$comment": "Date+Time: Years (integer) + Months (integer) + Days + Hours (integer) + Minutes with decimal (lowest order)", |
| 132 | + "pattern": "^P[0-9]+Y[0-9]+M[0-9]+DT[0-9]+H[0-9]+(?:\\.[0-9]+)?M$" |
| 133 | + }, |
| 134 | + { |
| 135 | + "$comment": "Date+Time: Years (integer) + Months (integer) + Days + Hours (integer) + Minutes (integer) + Seconds with decimal (lowest order)", |
| 136 | + "pattern": "^P[0-9]+Y[0-9]+M[0-9]+DT[0-9]+H[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 137 | + }, |
| 138 | + { |
| 139 | + "$comment": "Date+Time: Years (integer) + Months (integer) + Days + Minutes with decimal (lowest order)", |
| 140 | + "pattern": "^P[0-9]+Y[0-9]+M[0-9]+DT[0-9]+(?:\\.[0-9]+)?M$" |
| 141 | + }, |
| 142 | + { |
| 143 | + "$comment": "Date+Time: Years (integer) + Months (integer) + Days + Minutes (integer) + Seconds with decimal (lowest order)", |
| 144 | + "pattern": "^P[0-9]+Y[0-9]+M[0-9]+DT[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 145 | + }, |
| 146 | + { |
| 147 | + "$comment": "Date+Time: Years (integer) + Months (integer) + Days + Seconds with decimal (lowest order)", |
| 148 | + "pattern": "^P[0-9]+Y[0-9]+M[0-9]+DT[0-9]+(?:\\.[0-9]+)?S$" |
| 149 | + }, |
| 150 | + { |
| 151 | + "$comment": "Date+Time: Months + Hours with decimal (lowest order)", |
| 152 | + "pattern": "^P[0-9]+MT[0-9]+(?:\\.[0-9]+)?H$" |
| 153 | + }, |
| 154 | + { |
| 155 | + "$comment": "Date+Time: Months + Hours (integer) + Minutes with decimal (lowest order)", |
| 156 | + "pattern": "^P[0-9]+MT[0-9]+H[0-9]+(?:\\.[0-9]+)?M$" |
| 157 | + }, |
| 158 | + { |
| 159 | + "$comment": "Date+Time: Months + Hours (integer) + Minutes (integer) + Seconds with decimal (lowest order)", |
| 160 | + "pattern": "^P[0-9]+MT[0-9]+H[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 161 | + }, |
| 162 | + { |
| 163 | + "$comment": "Date+Time: Months + Minutes with decimal (lowest order)", |
| 164 | + "pattern": "^P[0-9]+MT[0-9]+(?:\\.[0-9]+)?M$" |
| 165 | + }, |
| 166 | + { |
| 167 | + "$comment": "Date+Time: Months + Minutes (integer) + Seconds with decimal (lowest order)", |
| 168 | + "pattern": "^P[0-9]+MT[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 169 | + }, |
| 170 | + { |
| 171 | + "$comment": "Date+Time: Months + Seconds with decimal (lowest order)", |
| 172 | + "pattern": "^P[0-9]+MT[0-9]+(?:\\.[0-9]+)?S$" |
| 173 | + }, |
| 174 | + { |
| 175 | + "$comment": "Date+Time: Months (integer) + Days + Hours with decimal (lowest order)", |
| 176 | + "pattern": "^P[0-9]+M[0-9]+DT[0-9]+(?:\\.[0-9]+)?H$" |
| 177 | + }, |
| 178 | + { |
| 179 | + "$comment": "Date+Time: Months (integer) + Days + Hours (integer) + Minutes with decimal (lowest order)", |
| 180 | + "pattern": "^P[0-9]+M[0-9]+DT[0-9]+H[0-9]+(?:\\.[0-9]+)?M$" |
| 181 | + }, |
| 182 | + { |
| 183 | + "$comment": "Date+Time: Months (integer) + Days + Hours (integer) + Minutes (integer) + Seconds with decimal (lowest order)", |
| 184 | + "pattern": "^P[0-9]+M[0-9]+DT[0-9]+H[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 185 | + }, |
| 186 | + { |
| 187 | + "$comment": "Date+Time: Months (integer) + Days + Minutes with decimal (lowest order)", |
| 188 | + "pattern": "^P[0-9]+M[0-9]+DT[0-9]+(?:\\.[0-9]+)?M$" |
| 189 | + }, |
| 190 | + { |
| 191 | + "$comment": "Date+Time: Months (integer) + Days + Minutes (integer) + Seconds with decimal (lowest order)", |
| 192 | + "pattern": "^P[0-9]+M[0-9]+DT[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 193 | + }, |
| 194 | + { |
| 195 | + "$comment": "Date+Time: Months (integer) + Days + Seconds with decimal (lowest order)", |
| 196 | + "pattern": "^P[0-9]+M[0-9]+DT[0-9]+(?:\\.[0-9]+)?S$" |
| 197 | + }, |
| 198 | + { |
| 199 | + "$comment": "Date+Time: Days + Hours with decimal (lowest order)", |
| 200 | + "pattern": "^P[0-9]+DT[0-9]+(?:\\.[0-9]+)?H$" |
| 201 | + }, |
| 202 | + { |
| 203 | + "$comment": "Date+Time: Days + Hours (integer) + Minutes with decimal (lowest order)", |
| 204 | + "pattern": "^P[0-9]+DT[0-9]+H[0-9]+(?:\\.[0-9]+)?M$" |
| 205 | + }, |
| 206 | + { |
| 207 | + "$comment": "Date+Time: Days + Hours (integer) + Minutes (integer) + Seconds with decimal (lowest order)", |
| 208 | + "pattern": "^P[0-9]+DT[0-9]+H[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 209 | + }, |
| 210 | + { |
| 211 | + "$comment": "Date+Time: Days + Minutes with decimal (lowest order)", |
| 212 | + "pattern": "^P[0-9]+DT[0-9]+(?:\\.[0-9]+)?M$" |
| 213 | + }, |
| 214 | + { |
| 215 | + "$comment": "Date+Time: Days + Minutes (integer) + Seconds with decimal (lowest order)", |
| 216 | + "pattern": "^P[0-9]+DT[0-9]+M[0-9]+(?:\\.[0-9]+)?S$" |
| 217 | + }, |
| 218 | + { |
| 219 | + "$comment": "Date+Time: Days + Seconds with decimal (lowest order)", |
| 220 | + "pattern": "^P[0-9]+DT[0-9]+(?:\\.[0-9]+)?S$" |
| 221 | + } |
| 222 | + ] |
| 223 | +} |
0 commit comments