Skip to content

Commit ccf3c9d

Browse files
LarsEckartJayBazuziisidore
committed
- F support for Date format reported by helgewessels, Jan 2025
Co-authored-by: Jay Bazuzi <[email protected]> Co-authored-by: Llewellyn Falco <[email protected]>
1 parent f7c5699 commit ccf3c9d

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

approvaltests-tests/src/test/java/org/approvaltests/scrubbers/DateScrubberTest.supportedFormats.approved.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
| 2020-09-10T01:23:45.678Z | \d{4}-\d{1,2}-\d{1,2}T\d{1,2}:\d{2}\:\d{2}\.\d{3}Z |
1616
| 20210505T091112Z | \d{8}T\d{6}Z |
1717
| 2024-12-17 | \d{4}-\d{2}-\d{2} |
18-
| 2024-12-18T14:04:46.746130Z | \d{4}-\d{1,2}-\d{1,2}T\d{1,2}:\d{2}:\d{2}.\d{1,6}Z |
18+
| 2024-12-18T14:04:46.746130Z | \d{4}-\d{1,2}-\d{1,2}T\d{1,2}:\d{2}:\d{2}(\.\d{1,9})?Z |

approvaltests-tests/src/test/java/org/approvaltests/scrubbers/DateScrubberTest.testGetDateScrubber.approved.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,17 @@ Example: {'date':"[Date1]"}
9292

9393

9494
Scrubbing for 2024-12-18T14:04:46.746130Z:
95-
RegExScrubber[\d{4}-\d{1,2}-\d{1,2}T\d{1,2}:\d{2}:\d{2}.\d{1,6}Z]
95+
RegExScrubber[\d{4}-\d{1,2}-\d{1,2}T\d{1,2}:\d{2}:\d{2}(\.\d{1,9})?Z]
96+
Example: {'date':"[Date1]"}
97+
98+
99+
Scrubbing for 2024-12-18T14:04:46Z:
100+
RegExScrubber[\d{4}-\d{1,2}-\d{1,2}T\d{1,2}:\d{2}:\d{2}Z]
101+
Example: {'date':"[Date1]"}
102+
103+
104+
Scrubbing for 2024-12-18T14:04:46.746130834Z:
105+
RegExScrubber[\d{4}-\d{1,2}-\d{1,2}T\d{1,2}:\d{2}:\d{2}(\.\d{1,9})?Z]
96106
Example: {'date':"[Date1]"}
97107

98108

approvaltests/src/main/java/org/approvaltests/scrubbers/DateScrubber.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public static SupportedFormat[] getSupportedFormats()
4141
"2020-09-10T01:23:45.678Z"),
4242
__("\\d{8}T\\d{6}Z", "20210505T091112Z"),
4343
__("\\d{4}-\\d{2}-\\d{2}", "2024-12-17"),
44-
__("\\d{4}-\\d{1,2}-\\d{1,2}T\\d{1,2}:\\d{2}:\\d{2}.\\d{1,6}Z",
45-
"2024-12-18T14:04:46.746130Z")};
44+
__("\\d{4}-\\d{1,2}-\\d{1,2}T\\d{1,2}:\\d{2}:\\d{2}(\\.\\d{1,9})?Z",
45+
"2024-12-18T14:04:46.746130Z", "2024-12-18T14:04:46Z", "2024-12-18T14:04:46.746130834Z")};
4646
}
4747
private static SupportedFormat __(String regex, String... examples)
4848
{

0 commit comments

Comments
 (0)