Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorin-Oakenpants authored Dec 1, 2024
1 parent 85fb8cf commit 9a40748
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/dtftimezonename.html
Original file line number Diff line number Diff line change
Expand Up @@ -316,21 +316,33 @@
"Asia/Muscat": tzSG,
}
} else {
// supported?
// test valid timezone
try {
let testDate = new Date()
let test = new Intl.DateTimeFormat('en', {timeZone: method}).format(testDate)
} catch(e) {
console.log(e)
dom.results.innerHTML = s16 + e.name +": "+ sc + e.message
return
}
/*
// only allow supported
let methodtest = method.toLowerCase()
if (!aTimezonesSupportedLowerCase.includes(methodtest)) {
dom.results.innerHTML = s3 + method +": "+ sc +'not supported'
return
}
//*/
tests = {}
tests[method] = both
}
// remove unsupported: e.g. from tiny/min lists
for (const k of Object.keys(tests)) {
if (!aTimezonesLowerCase.includes(k.toLowerCase())) {delete tests[k]}
if ('all' == method || 'min' == method || 'tiny' == method) {
// remove unsupported: e.g. from tiny/min lists
for (const k of Object.keys(tests)) {
if (!aTimezonesLowerCase.includes(k.toLowerCase())) {delete tests[k]}
}
}


let tzUsed = []
Object.keys(tests).forEach(function(tz) {
tzUsed.push(tz)
Expand Down

0 comments on commit 9a40748

Please sign in to comment.