@@ -158,26 +158,37 @@ public function testDateFormatting(string $input, string $expected) {
158
158
*/
159
159
public function edtfDateFormatProvider (): array {
160
160
return [
161
- // Basic single dates.
162
- 'Full date ' => [
163
- 'input ' => '1996-04-22 ' ,
164
- // Default format.
165
- 'expected ' => '1996-04-22 ' ,
161
+ // EDTF Level 0
162
+ 'Date - complete ' => [
163
+ 'input ' => '1985-04-12 ' ,
164
+ 'expected ' => '1985-04-12 ' ,
166
165
],
167
- 'Year ' => [
168
- 'input ' => '1975 ' ,
169
- 'expected ' => '1975 ' ,
166
+ 'Date - reduced precision - year and month ' => [
167
+ 'input ' => '1985-04 ' ,
168
+ 'expected ' => '1985-04 ' ,
170
169
],
171
- 'Year-month ' => [
172
- 'input ' => '2025-02 ' ,
173
- 'expected ' => '2025-02 ' ,
170
+ 'Date - reduced precision - year ' => [
171
+ 'input ' => '1985 ' ,
172
+ 'expected ' => '1985 ' ,
174
173
],
175
- 'Date and time (no TZ) ' => [
174
+ 'Date and time - local ' => [
176
175
'original ' => '2024-10-15T12:00:00 ' ,
177
176
'formatted ' => '2024-10-15 12:00:00 ' ,
178
177
],
178
+ 'Date and time - Z ' => [
179
+ 'original ' => '1985-04-12T23:20:30Z ' ,
180
+ 'formatted ' => '1985-04-12 23:20:30Z ' ,
181
+ ],
182
+ 'Date and time - shift in hours ' => [
183
+ 'original ' => '1985-04-12T23:20:30+04 ' ,
184
+ 'formatted ' => '1985-04-12 23:20:30+04 ' ,
185
+ ],
186
+ 'Date and time - shift in hours and minutes ' => [
187
+ 'original ' => '1985-04-12T23:20:30+04:30 ' ,
188
+ 'formatted ' => '1985-04-12 23:20:30+04:30 ' ,
189
+ ],
179
190
180
- // Uncertain/approximate dates.
191
+ // EDTF level 1
181
192
'Uncertain year ' => [
182
193
'input ' => '1984? ' ,
183
194
'expected ' => '1984 (year uncertain) ' ,
@@ -198,6 +209,10 @@ public function edtfDateFormatProvider(): array {
198
209
'original ' => '2024-10 ' ,
199
210
'formatted ' => '2024-10 ' ,
200
211
],
212
+ 'Unspecified digits from right ' => [
213
+ 'input ' => '198X ' ,
214
+ 'expected ' => 'Unknown year in the decade of the 1980s ' ,
215
+ ],
201
216
202
217
// Invalid/edge cases
203
218
'Empty input ' => [
0 commit comments