Created
September 10, 2024 11:33
-
-
Save hushin/133b38e9a8a6050655143cbbe0dae269 to your computer and use it in GitHub Desktop.
Googleのマイアクティビティを日付指定で開く
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
function generateMyActivityURLJST(date) { | |
const startDate = new Date(`${date}T00:00:00+09:00`); | |
const endDate = new Date(`${date}T23:59:59+09:00`); | |
// ミリ秒単位のタイムスタンプをマイクロ秒に変換 | |
const min = startDate.getTime() * 1000; | |
const max = endDate.getTime() * 1000 + 999999; | |
// Google My Activity の URL を生成 | |
const url = `https://myactivity.google.com/myactivity?min=${min}&max=${max}`; | |
return url; | |
} | |
const url = generateMyActivityURLJST('2024-09-05'); | |
location.assign(url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment