Javascript时区获取位置类似于PHP DateTimeZone::getLocation?

Javascript时区获取位置类似于PHP DateTimeZone::getLocation?,javascript,node.js,geolocation,timezone,location,Javascript,Node.js,Geolocation,Timezone,Location,有没有人知道一个库、函数或API的功能与PHP DateTimeZone::getLocation的功能相同,只是用于Javascript(或NodeJS NPM) 请注意,不要只是为了给我指出正确的方向而寻找代码。试着寻找类似的东西,但什么都找不到 例如- 我想采用UTC偏移量或时区: utc_offset: -25200, time_zone: 'Pacific Time (US & Canada)', 然后根据以下内容返回位置/地理位置: country_code: CZ lat

有没有人知道一个库、函数或API的功能与PHP DateTimeZone::getLocation的功能相同,只是用于Javascript(或NodeJS NPM)

请注意,不要只是为了给我指出正确的方向而寻找代码。试着寻找类似的东西,但什么都找不到

例如-

我想采用UTC偏移量或时区:

utc_offset: -25200,
time_zone: 'Pacific Time (US & Canada)',
然后根据以下内容返回位置/地理位置:

country_code: CZ
latitude: 50.08333
longitude: 14.43333
您可以使用JodaAPI。
希望它能有所帮助^ ^

由于时间紧迫,我决定基于PHP DateTimeZone::getLocation函数制作一个小API。我可能会在稍后阶段将其作为公共API

这里还有要下载的gitHub:



谢谢allot@thanhnd25如果我发现使用它,我会看一看并标记为答案,Cheers只是快速看一看JodaAPI是一个“Java”API而不是“Javascript”?谢谢我稍后会看一看,我只是基于PHP DateTimeZone::getLocation制作了一个小的Javascript API。
<?php

//usage: /?timezone=Europe/Prague
//output(JSON): {"country_code":"CZ","latitude":50.08333,"longitude":14.43333,"comments":""}

if(isset($_GET['timezone'])) {

    $timezone = $_GET['timezone'];

    try {

        $timezone = new DateTimeZone($timezone);
        output(timezone_location_get($timezone));

    } catch(Exception $error) {
        output(array('error' => 'bad timezone')); //or add $error for full message 
    }
}

function output($data){
    echo json_encode($data);
}

?>