0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

入眠時間を考慮する睡眠サイクル計算機を作った

0
Last updated at Posted at 2026-04-29

作ったもの

Sleep Alarmhttps://sen.ltd/portfolio/sleep-alarm/

スクリーンショット

  • 2 モード: 「起きたい時刻」→ 就寝時刻提案 / 「寝る時刻」→ 起床時刻提案
  • 3〜6 サイクルのオプションを品質ラベル付きで表示
  • 入眠時間(0〜30 分)を考慮
  • 睡眠フェーズの可視化

vanilla JS、ゼロ依存、ビルド不要node --test で 42 ケース。

90 分サイクル + 入眠時間

「22:00 に寝る」と「22:00 に眠りに落ちる」は違う。入眠に 15 分かかるなら、実際の睡眠開始は 22:15。この 15 分を計算に含めるかどうかで提案時刻が変わります。

const totalMinutes = cycles * 90 + fallAsleepMin;
const bedtime = new Date(wakeUpTime - totalMinutes * 60000);

シリーズ

100+ 公開ポートフォリオ シリーズの #40 です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?