-
Notifications
You must be signed in to change notification settings - Fork 172
Closed
Labels
no-spec-textPR can be ignored by implementorsPR can be ignored by implementorsnon-prod-polyfillTHIS POLYFILL IS NOT FOR PRODUCTION USE!THIS POLYFILL IS NOT FOR PRODUCTION USE!
Description
While investigating TS errors in temporal-polyfill, I noticed that proposal-temporal polyfill's implementation of ParseISODateTime adds a zoneRequired option. (It's not in the spec, this is just in the polyfill.) What is this option used for?
I'm asking because strings that have no time zone nor offset will still return a successful match from that function, albeit with the timezone and offset fields undefined. Is this expected? If yes, then what's the purpose of that option?
Repro:
zoneRequiredRegex = new RegExp('^((?:[+\\u2212-]\\d{6}|\\d{4}))(?:-((?:0[1-9]|1[0-2]))-((?:0[1-9]|[12]\\d|3[01]))|((?:0[1-9]|1[0-2]))((?:0[1-9]|[12]\\d|3[01])))(?:(?:T|\\s+)(\\d{2})(?::(\\d{2})(?::(\\d{2})(?:[.,](\\d{1,9}))?)?|(\\d{2})(?:(\\d{2})(?:[.,](\\d{1,9}))?)?)?)?(?:([zZ])|(?:([+\\u2212-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\\d{1,9}))?)?)?)?)(?:\\[((?:(?:\\.[-A-Za-z_]|\\.\\.[-A-Za-z._]{1,12}|\\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13})(?:\\/(?:\\.[-A-Za-z_]|\\.\\.[-A-Za-z._]{1,12}|\\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13}))*|Etc\\/GMT[-+]\\d{1,2}|(?:[+\\u2212-][0-2][0-9](?::?[0-5][0-9](?::?[0-5][0-9](?:[.,]\\d{1,9})?)?)?)))\\])?(?:\\[u-ca=((?:[A-Za-z0-9]{3,8}(?:-[A-Za-z0-9]{3,8})*))\\])?$', 'i');
zoneRequiredRegex.test('2021-08-19T17:30');
// => trueMetadata
Metadata
Assignees
Labels
no-spec-textPR can be ignored by implementorsPR can be ignored by implementorsnon-prod-polyfillTHIS POLYFILL IS NOT FOR PRODUCTION USE!THIS POLYFILL IS NOT FOR PRODUCTION USE!