Drying out
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useStats } from '../../hooks/useStats';
|
||||
import { formatMinutesAfter, getToday, getLocalOffsetFromReference, timeToMinutes } from '../../utils/time';
|
||||
import { formatMinutesAfter, getToday, getLocalOffsetFromReference } from '../../utils/time';
|
||||
import {
|
||||
LineChart,
|
||||
Line,
|
||||
@@ -35,16 +35,7 @@ const WakeupPlot: React.FC<WakeupBedtimeProps> = ({ from_date, to_date, wakeup_r
|
||||
|
||||
let offsetFromRef = 0;
|
||||
if (day.wakeup_minutes !== null) {
|
||||
const refMins = timeToMinutes(wakeup_ref);
|
||||
// If wakeup_minutes is significantly smaller than the reference,
|
||||
// it's likely already an offset (relative), not absolute minutes from midnight.
|
||||
const isLikelyOffset = day.wakeup_minutes < refMins && day.wakeup_minutes < 120;
|
||||
|
||||
if (isLikelyOffset) {
|
||||
offsetFromRef = day.wakeup_minutes;
|
||||
} else {
|
||||
offsetFromRef = day.wakeup_minutes - refMins;
|
||||
}
|
||||
offsetFromRef = getLocalOffsetFromReference(day.wakeup_minutes, wakeup_ref);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user