Intl.Locale.prototype.getTimeZones()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Intl.Locale 인스턴스의 getTimeZones() 메서드는 이 로케일에 지원되는 시간대 목록을 반환합니다.

참고 : 일부 브라우저의 일부 버전에서는 이 메서드가 timeZones라는 접근자 속성으로 구현되었습니다. 그러나 이 메서드는 접근할 때마다 새로운 배열을 반환하기 때문에 locale.timeZones === locale.timeZonesfalse를 반환하는 상황을 방지하기 위해 이제 메서드로 구현되었습니다. 자세한 내용은 브라우저 호환성 표를 참조하세요.

구문

js
getTimeZones()

매개변수

없음.

반환 값

연결된 Locale에 대해 지원되는 시간대를 나타내는 문자열 배열로, 각 값은 알파벳 순서로 정렬된 IANA 표준 시간대 이름입니다. 로케일 식별자에 지역 하위 태그가 포함되지 않은 경우 반환되는 값은 undefined입니다.

예제

지원되는 시간대 얻기

주어진 Locale을 지원하는 시간대 목록.

js
const arEG = new Intl.Locale("ar-EG");
console.log(arEG.getTimeZones()); // ["Africa/Cairo"]
js
const jaJP = new Intl.Locale("ja-JP");
console.log(jaJP.getTimeZones()); // ["Asia/Tokyo"]
js
const ar = new Intl.Locale("ar");
console.log(ar.getTimeZones()); // undefined

명세서

Specification
Intl Locale Info Proposal
# sec-Intl.Locale.prototype.getTimeZones

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
getTimeZones

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.
Uses a non-standard name.
Has more compatibility info.

같이 보기