|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
683 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var $TypeError = require('es-errors/type');
|
|---|
| 4 |
|
|---|
| 5 | var regexTester = require('safe-regex-test');
|
|---|
| 6 |
|
|---|
| 7 | // https://tc39.es/ecma262/#sec-istimezoneoffsetstring
|
|---|
| 8 |
|
|---|
| 9 | // implementation taken from https://github.com/tc39/proposal-temporal/blob/21ee5b13f0672990c807475ba094092d19dd6dc5/polyfill/lib/ecmascript.mjs#L2140
|
|---|
| 10 |
|
|---|
| 11 | var OFFSET = /^([+\u2212-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?$/;
|
|---|
| 12 |
|
|---|
| 13 | var testOffset = regexTester(OFFSET);
|
|---|
| 14 |
|
|---|
| 15 | module.exports = function IsTimeZoneOffsetString(offsetString) {
|
|---|
| 16 | if (typeof offsetString !== 'string') {
|
|---|
| 17 | throw new $TypeError('Assertion failed: `offsetString` must be a String');
|
|---|
| 18 | }
|
|---|
| 19 | return testOffset(offsetString);
|
|---|
| 20 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.