From e4721af79bc0a3706d390af28f0a29f08b16d49c Mon Sep 17 00:00:00 2001 From: zhangdd_ewan Date: Wed, 17 May 2023 02:07:07 +0000 Subject: [PATCH] =?UTF-8?q?#I73PJ0:GetTimezonesByLocation=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangdd_ewan --- .../reference/apis/js-apis-i18n.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/zh-cn/application-dev/reference/apis/js-apis-i18n.md b/zh-cn/application-dev/reference/apis/js-apis-i18n.md index 1ab0f3ee0b..0672bb3822 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-i18n.md +++ b/zh-cn/application-dev/reference/apis/js-apis-i18n.md @@ -1737,6 +1737,35 @@ static getTimezoneFromCity(cityID: string): TimeZone let timezone = I18n.TimeZone.getTimezoneFromCity("Shanghai"); ``` +### getTimezonesByLocation10+ + +static getTimezonesByLocation(longitude: number, latitude: number): Array<TimeZone> + +创建某经纬度对应的时区对象数组。 + +**系统能力**:SystemCapability.Global.I18n + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | ------ | +| longitude | number | 是 | 经度, 范围[-180, 179.9),东经取正值,西经取负值 | +| latitude | number | 是 | 纬度, 范围[-90, 89.9),北纬取正值,南纬取负值 | + +**返回值:** + +| 类型 | 说明 | +| -------- | ----------- | +| TimeZone | 时区城市对应的时区对象 | + +**示例:** + ```ts + let timezoneArray = I18n.TimeZone.getTimezonesByLocation(-118.1, 34.0); + for (var i = 0; i < timezoneArray.length; i++) { + let tzId = timezoneArray[i].getID(); + } + ``` + ## Transliterator9+ -- GitLab