• <legend id='KQAwf'><style id='KQAwf'><dir id='KQAwf'><q id='KQAwf'></q></dir></style></legend>

      <tfoot id='KQAwf'></tfoot>
      <i id='KQAwf'><tr id='KQAwf'><dt id='KQAwf'><q id='KQAwf'><span id='KQAwf'><b id='KQAwf'><form id='KQAwf'><ins id='KQAwf'></ins><ul id='KQAwf'></ul><sub id='KQAwf'></sub></form><legend id='KQAwf'></legend><bdo id='KQAwf'><pre id='KQAwf'><center id='KQAwf'></center></pre></bdo></b><th id='KQAwf'></th></span></q></dt></tr></i><div id='KQAwf'><tfoot id='KQAwf'></tfoot><dl id='KQAwf'><fieldset id='KQAwf'></fieldset></dl></div>
    1. <small id='KQAwf'></small><noframes id='KQAwf'>

        • <bdo id='KQAwf'></bdo><ul id='KQAwf'></ul>

        使用 moment.js 检测当前用户时区的 ID

        时间:2023-06-14

        <tfoot id='UoSKr'></tfoot>
            <tbody id='UoSKr'></tbody>

                <bdo id='UoSKr'></bdo><ul id='UoSKr'></ul>
              • <small id='UoSKr'></small><noframes id='UoSKr'>

                  <legend id='UoSKr'><style id='UoSKr'><dir id='UoSKr'><q id='UoSKr'></q></dir></style></legend>
                1. <i id='UoSKr'><tr id='UoSKr'><dt id='UoSKr'><q id='UoSKr'><span id='UoSKr'><b id='UoSKr'><form id='UoSKr'><ins id='UoSKr'></ins><ul id='UoSKr'></ul><sub id='UoSKr'></sub></form><legend id='UoSKr'></legend><bdo id='UoSKr'><pre id='UoSKr'><center id='UoSKr'></center></pre></bdo></b><th id='UoSKr'></th></span></q></dt></tr></i><div id='UoSKr'><tfoot id='UoSKr'></tfoot><dl id='UoSKr'><fieldset id='UoSKr'></fieldset></dl></div>
                2. 本文介绍了使用 moment.js 检测当前用户时区的 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在寻找一种检测浏览器时区 ID 的方法(如 Olson 表中所定义)但我不关心确切的 ID,我只需要与用户的 ID 相同的时区 ID(例如,如果用户在巴黎,Europe/Rome"就可以了).

                  What I'm looking for is a way to detect the browser's timezone ID (as defined in the Olson tables) but I don't care for the exact ID, I just need the ID of a timezone that works the same as the user's one (for example "Europe/Rome" is fine if the user is in Paris).

                  我对当前的偏移量不感兴趣,我真的需要时区,以便我可以将其发送到服务器以计算其他日期(服务器也有 Olson 表).

                  I'm not interested in the current offset, I really need the timezone so that I can send it to the server to do computations for other dates (the server has the Olson tables too).

                  理论上,因为我已经使用了 Moment.js 时区库 并且已经包含了 Olson 表,所以我不需要其他任何东西,但我没有找到任何 API 来进行检测.我不知道它是否隐藏在某个地方,或者是否有人已经写了它.问题之一是当前时区插件似乎将其数据保密.

                  Theoretically, as I already use Moment.js timezone library and have included the Olson tables, I don't need anything else, but I don't find any API to do the detection. I don't know if it's hidden somewhere or if somebody has it already written. One of the problems is that the current timezone plugin seems to keep its data private.

                  不'想要一个基于 Olson 表的另一个副本或提取的集成的解决方案(我必须维护),我知道有一些库复制它们,我想使用我在 Moment.js 中已有的那些.

                  I dont' want a solution based on the integration of yet another copy or extract of the Olson tables (which I would have to maintain), I know there are a few libraries duplicating them, I want to use the ones I already have in Moment.js.

                  推荐答案

                  moment 现在有 guess() API 作为 描述在这里

                  moment now has the guess() API as described here

                  这篇关于使用 moment.js 检测当前用户时区的 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:你如何保存从浏览器到服务器的 JavaScript 日期的时区,然后返回? 下一篇:Google Apps 脚本 formatDate 使用用户的时区而不是 GMT

                  相关文章

                3. <i id='L4Hyf'><tr id='L4Hyf'><dt id='L4Hyf'><q id='L4Hyf'><span id='L4Hyf'><b id='L4Hyf'><form id='L4Hyf'><ins id='L4Hyf'></ins><ul id='L4Hyf'></ul><sub id='L4Hyf'></sub></form><legend id='L4Hyf'></legend><bdo id='L4Hyf'><pre id='L4Hyf'><center id='L4Hyf'></center></pre></bdo></b><th id='L4Hyf'></th></span></q></dt></tr></i><div id='L4Hyf'><tfoot id='L4Hyf'></tfoot><dl id='L4Hyf'><fieldset id='L4Hyf'></fieldset></dl></div>

                  <small id='L4Hyf'></small><noframes id='L4Hyf'>

                  1. <legend id='L4Hyf'><style id='L4Hyf'><dir id='L4Hyf'><q id='L4Hyf'></q></dir></style></legend>

                      <bdo id='L4Hyf'></bdo><ul id='L4Hyf'></ul>
                  2. <tfoot id='L4Hyf'></tfoot>