Created
November 30, 2021 05:55
-
-
Save Philmist/93d449d18bdd2d3f27608ad1322bd8da to your computer and use it in GitHub Desktop.
mc-clock v3にタイムゾーンを追加する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.6/dayjs.min.js"></script> | |
<!-- ここから追加 --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.6/plugin/utc.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.6/plugin/timezone.js"></script> | |
<!-- ここまで追加 --> | |
<link rel="preconnect" href="https://fonts.gstatic.com"> | |
<script language="JavaScript"> | |
// *ここから追加* | |
dayjs.extend(window.dayjs_plugin_utc); | |
dayjs.extend(window.dayjs_plugin_timezone); | |
// *ここまで追加* | |
const day = function() { | |
// 次の行をタイムゾーンに合わせて改変 | |
const dt = dayjs(new Date()).tz("America/New_York"); | |
// タイムゾーン表記はtzdataに基づいて指定する | |
const element = document.getElementById("t"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment