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

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

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

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

        如何将 IST 时区对象添加到 Moment.js

        How to add IST timezone object to Moment.js(如何将 IST 时区对象添加到 Moment.js)
          <bdo id='KjTyH'></bdo><ul id='KjTyH'></ul>

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

            <legend id='KjTyH'><style id='KjTyH'><dir id='KjTyH'><q id='KjTyH'></q></dir></style></legend>
                <tbody id='KjTyH'></tbody>

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

                  本文介绍了如何将 IST 时区对象添加到 Moment.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我指的是 http://momentjs.com/timezone/docs/#/using-timezones/

                  例如,它针对以下位置给出:

                  In example, its given for below locations :

                  moment.tz.add([
                      'America/Los_Angeles|PST PDT|80 70|0101|1Lzm0 1zb0 Op0',
                      'America/New_York|EST EDT|50 40|0101|1Lz50 1zb0 Op0'
                  ]);
                  

                  我不确定 IST 值是否为:

                  I am not sure of IST values as its given for :

                  {
                      name    : 'America/Los_Angeles',          // the unique identifier
                      abbrs   : ['PDT', 'PST'],                 // the abbreviations
                      untils  : [1414918800000, 1425808800000], // the timestamps in milliseconds
                      offsets : [420, 480]                      // the offsets in minutes
                  }
                  

                  有人可以帮忙添加 IST 对象吗?

                  Could someone help in adding IST object to this?

                  推荐答案

                  最简单的方法是只使用包含来自 moment-timezone 主页,例如 moment-timezone-2010-2020.jsmoment-timezone-all-years.js(或缩小版).

                  The easiest way is to just use one of the files that includes time zone data from the moment-timezone home page, such as moment-timezone-2010-2020.js or moment-timezone-all-years.js (or the minified versions).

                  但是,如果您愿意,也可以只添加一个区域.您可以在上面列出的数据文件中找到该区域的打包字符串.对于印度,完整的区域定义是:

                  You can however add just a single zone if you prefer. You can find the zone's packed string within the data files listed above. For India, the full zone definition is:

                  moment.tz.add("Asia/Calcutta|HMT BURT IST IST|-5R.k -6u -5u -6u|01232|-18LFR.k 1unn.k HB0 7zX0");
                  moment.tz.link("Asia/Calcutta|Asia/Kolkata");
                  

                  您可能需要也可能不需要该链接,具体取决于您正在做什么.

                  You may or may not need the link, depending on what exactly you're doing.

                  请注意,我假设IST"是指印度标准时间,而不是 爱尔兰标准时间或以色列标准时间.当然,这些区域会有不同的数据.

                  Note that I assumed that by "IST" you mean India Standard Time, and not Irish Standard Time or Israel Standard Time. Those zones would have different data, of course.

                  此外,由于印度自 1942 年以来一直使用 UTC+5:30,您可能只希望使用固定偏移量 - 这将消除使用时刻时区的需要.只需立即使用 utcOffset 函数.例如,以下两个都将返回印度的当前时间.

                  Also, since India has been on UTC+5:30 since 1942, you may just wish to use a fixed offset - which would eliminate the need to use moment-timezone. Just use the utcOffset function in moment. For example, both of the following will return the current time in India.

                  moment().utcOffset("+05:30").format()
                  

                  moment().utcOffset(330).format()
                  

                  这篇关于如何将 IST 时区对象添加到 Moment.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What are valid deviceNames for Chrome emulation testing with Protractor?(使用 Protractor 进行 Chrome 模拟测试的有效设备名称是什么?)
                  Protractor Check if Element Does Not Exist(量角器检查元素是否不存在)
                  Protractor e2e Tests Login Redirection(Protractor e2e 测试登录重定向)
                  Explain about async/ await in Protractor(解释 Protractor 中的 async/await)
                  Protractor browser.wait doesn#39;t wait(量角器 browser.wait 不等待)
                  How to use Protractor with Angular 2?(如何在 Angular 2 中使用量角器?)
                  • <bdo id='SdF9B'></bdo><ul id='SdF9B'></ul>
                  • <tfoot id='SdF9B'></tfoot>
                        <tbody id='SdF9B'></tbody>

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

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