constructor-options-timeZoneName-valid.js (1169B)
1 // Copyright 2021 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-createdatetimeformat 5 description: > 6 Valid values for the `timeZoneName` option of the DateTimeFormat constructor 7 features: [Intl.DateTimeFormat-extend-timezonename] 8 ---*/ 9 10 var dtf; 11 12 dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'short' }); 13 assert.sameValue(dtf.resolvedOptions().timeZoneName, 'short'); 14 15 dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'long' }); 16 assert.sameValue(dtf.resolvedOptions().timeZoneName, 'long'); 17 18 dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'shortOffset' }); 19 assert.sameValue(dtf.resolvedOptions().timeZoneName, 'shortOffset'); 20 21 dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'longOffset' }); 22 assert.sameValue(dtf.resolvedOptions().timeZoneName, 'longOffset'); 23 24 dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'shortGeneric' }); 25 assert.sameValue(dtf.resolvedOptions().timeZoneName, 'shortGeneric'); 26 27 dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'longGeneric' }); 28 assert.sameValue(dtf.resolvedOptions().timeZoneName, 'longGeneric'); 29 30 reportCompare(0, 0);