-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55115e1
commit f1833a4
Showing
15 changed files
with
339 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const getCurrentDateInJST = () => { | ||
const date = new Date(); | ||
const jstOffset = 9 * 60; // JST is UTC+9 | ||
const localOffset = date.getTimezoneOffset(); | ||
date.setMinutes(date.getMinutes() + localOffset + jstOffset); | ||
|
||
const YYYY = date.getFullYear(); | ||
const MM = String(date.getMonth() + 1).padStart(2, "0"); // Months are 0-based | ||
const DD = String(date.getDate()).padStart(2, "0"); | ||
const HH = String(date.getHours()).padStart(2, "0"); | ||
const mm = String(date.getMinutes()).padStart(2, "0"); | ||
const SS = String(date.getSeconds()).padStart(2, "0"); | ||
|
||
return `${YYYY}${MM}${DD}${HH}${mm}${SS}`; | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { getCurrentDateInJST } from "./getDate"; | ||
|
||
export const storeDate = () => { | ||
const storedDateInJST = localStorage.getItem("lastCheckedDateJST"); | ||
const currentDateInJST = getCurrentDateInJST(); | ||
|
||
if (!storedDateInJST) { | ||
// If there's no stored date, set the current date to local storage. | ||
localStorage.setItem("lastCheckedDateJST", currentDateInJST); | ||
} else if (storedDateInJST !== currentDateInJST) { | ||
// If the stored date and the current date are different, update the stored date. | ||
localStorage.setItem("lastCheckedDateJST", currentDateInJST); | ||
} | ||
}; |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.