Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
test262
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pmaksimo
test262
Commits
d5075819
Commit
d5075819
authored
9 years ago
by
André Bargull
Browse files
Options
Downloads
Patches
Plain Diff
Check resolved time zone is valid
parent
438b87b5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
harness/testIntl.js
+37
-0
37 additions, 0 deletions
harness/testIntl.js
test/intl402/12.3.3.js
+1
-1
1 addition, 1 deletion
test/intl402/12.3.3.js
with
38 additions
and
1 deletion
harness/testIntl.js
+
37
−
0
View file @
d5075819
...
...
@@ -1147,6 +1147,43 @@ function testValidDateTimeComponentValue(component, value) {
}
/**
* @description Tests whether timeZone is a String value representing a
* structurally valid and canonicalized time zone name, as defined in
* sections 6.4.1 and 6.4.2 of the ECMAScript Internationalization API
* Specification.
* @param {String} timeZone the string to be tested.
* @result {Boolean} whether the test succeeded.
*/
function
isCanonicalizedStructurallyValidTimeZoneName
(
timeZone
)
{
/**
* Regular expression defining IANA Time Zone names.
*
* Spec: IANA Time Zone Database, Theory file
*/
var
fileNameComponent
=
"
(?:[A-Za-z_]|
\\
.(?!
\\
.?(?:/|$)))[A-Za-z.
\\
-_]{0,13}
"
;
var
fileName
=
fileNameComponent
+
"
(?:/
"
+
fileNameComponent
+
"
)*
"
;
var
etcName
=
"
(?:Etc/)?GMT[+-]
\\
d{1,2}
"
;
var
systemVName
=
"
SystemV/[A-Z]{3}
\\
d{1,2}(?:[A-Z]{3})?
"
;
var
legacyName
=
etcName
+
"
|
"
+
systemVName
+
"
|CST6CDT|EST5EDT|MST7MDT|PST8PDT|NZ|Canada/East-Saskatchewan
"
;
var
zoneNamePattern
=
new
RegExp
(
"
^(?:
"
+
fileName
+
"
|
"
+
legacyName
+
"
)$
"
);
if
(
typeof
timeZone
!==
"
string
"
)
{
return
false
;
}
// 6.4.2 CanonicalizeTimeZoneName (timeZone), step 3
if
(
timeZone
===
"
UTC
"
)
{
return
true
;
}
// 6.4.2 CanonicalizeTimeZoneName (timeZone), step 3
if
(
timeZone
===
"
Etc/UTC
"
||
timeZone
===
"
Etc/GMT
"
)
{
return
false
;
}
return
zoneNamePattern
.
test
(
timeZone
);
}
/**
* Verifies that the actual array matches the expected one in length, elements,
* and element order.
...
...
This diff is collapsed.
Click to expand it.
test/intl402/12.3.3.js
+
1
−
1
View file @
d5075819
...
...
@@ -40,7 +40,7 @@ var calendars = [
mustHaveProperty
(
actual
,
"
locale
"
,
isCanonicalizedStructurallyValidLanguageTag
);
mustHaveProperty
(
actual
,
"
calendar
"
,
calendars
);
mustHaveProperty
(
actual
,
"
numberingSystem
"
,
isValidNumberingSystem
);
mustHaveProperty
(
actual
,
"
timeZone
"
,
[
undefined
]
);
mustHaveProperty
(
actual
,
"
timeZone
"
,
isCanonicalizedStructurallyValidTimeZoneName
);
mustNotHaveProperty
(
actual
,
"
weekday
"
);
mustNotHaveProperty
(
actual
,
"
era
"
);
mustHaveProperty
(
actual
,
"
year
"
,
[
"
2-digit
"
,
"
numeric
"
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment