Skip to content

Commit aa694cd

Browse files
committed
#139: Additional valid EDTF inputs
1 parent 6ad41ef commit aa694cd

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

tests/src/Kernel/EDTFFormatterTest.php

+23-7
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,30 @@ public function edtfDateFormatProvider(): array {
163163
'input' => '1985-04-12',
164164
'expected' => '1985-04-12',
165165
],
166-
'Year' => [
167-
'input' => '1975',
168-
'expected' => '1975',
166+
'Date - reduced precision - year and month' => [
167+
'input' => '1985-04',
168+
'expected' => '1985-04',
169169
],
170-
'Year-month' => [
171-
'input' => '2025-02',
172-
'expected' => '2025-02',
170+
'Date - reduced precision - year' => [
171+
'input' => '1985',
172+
'expected' => '1985',
173173
],
174-
'Date and time (no TZ)' => [
174+
'Date and time - local' => [
175175
'original' => '2024-10-15T12:00:00',
176176
'formatted' => '2024-10-15 12:00:00',
177177
],
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+
],
178190

179191
// EDTF level 1.
180192
'Uncertain year' => [
@@ -197,6 +209,10 @@ public function edtfDateFormatProvider(): array {
197209
'original' => '2024-10',
198210
'formatted' => '2024-10',
199211
],
212+
'Unspecified digits from right' => [
213+
'input' => '198X',
214+
'expected' => 'Unknown year in the decade of the 1980s',
215+
],
200216

201217
// Invalid/edge cases.
202218
'Empty input' => [

0 commit comments

Comments
 (0)