Skip to content

Commit 1957b1d

Browse files
committed
Action isoTimestamp allows space in UTC offset
1 parent f9e39c0 commit 1957b1d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

library/src/actions/isoTimestamp/isoTimestamp.test.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('isoTimestamp', () => {
8484
'0000-01-01T00:00:00.000+0000',
8585
'2023-07-11T17:26:27.243+1234',
8686
'9999-12-31T23:59:59.999+2359',
87-
// // '+hh'
87+
// '+hh'
8888
'0000-01-01T00:00:00.000+00',
8989
'2023-07-11T17:26:27.243+12',
9090
'9999-12-31T23:59:59.999+23',
@@ -96,7 +96,7 @@ describe('isoTimestamp', () => {
9696
'0000-01-01T00:00:00.000-0000',
9797
'2023-07-11T17:26:27.243-1234',
9898
'9999-12-31T23:59:59.999-2359',
99-
// // '-hh'
99+
// '-hh'
100100
'0000-01-01T00:00:00.000-00',
101101
'2023-07-11T17:26:27.243-12',
102102
'9999-12-31T23:59:59.999-23',
@@ -126,6 +126,17 @@ describe('isoTimestamp', () => {
126126
'9999-12-31 23:59:59.999Z',
127127
]);
128128
});
129+
130+
test('for space as separator in UTC offset', () => {
131+
expectNoActionIssue(action, [
132+
'0000-01-01 00:00:00.000 +00:00',
133+
'0000-01-01 00:00:00.000 -00:00',
134+
'2023-07-11 17:26:27.243 +0000',
135+
'2023-07-11 17:26:27.243 -0000',
136+
'9999-12-31 23:59:59.999 +00',
137+
'9999-12-31 23:59:59.999 -00',
138+
]);
139+
});
129140
});
130141

131142
describe('should return dataset with issues', () => {

library/src/regex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const ISO_TIME_SECOND_REGEX: RegExp =
107107
* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp regex.
108108
*/
109109
export const ISO_TIMESTAMP_REGEX: RegExp =
110-
/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z|[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u;
110+
/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z| ?[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u;
111111

112112
/**
113113
* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) week regex.

0 commit comments

Comments
 (0)