fix: 4 bugs — MSK today events, settings scroll, note dates, persistent notes volume
All checks were successful
Deploy / deploy (push) Successful in 4m35s
All checks were successful
Deploy / deploy (push) Successful in 4m35s
- calendar API: today/week ranges use Moscow time (UTC+3) instead of UTC — previously today events did not appear until 03:00 MSK - settings tab: add -webkit-overflow-scrolling: touch + touchAction pan-y for tablet scroll - NotesTab: add date picker (pinDate) in editor header + date badge in list - home: pinnedNotes now filters by pinDate (today or future), falls back to latest - notes/auth: storage moved from /tmp to /data (falls back to /tmp if /data missing) - deploy workflow: mount /opt/digital-home/smart-home-tablet-data:/data so notes survive redeploys
This commit is contained in:
@@ -43,12 +43,21 @@ export async function GET(req: Request) {
|
||||
let timeMin: string
|
||||
let timeMax: string
|
||||
|
||||
// Moscow boundaries (UTC+3, no DST). 00:00 MSK = 21:00 UTC previous day.
|
||||
const MSK_OFFSET_MS = 3 * 3600 * 1000
|
||||
const mskNow = new Date(now.getTime() + MSK_OFFSET_MS)
|
||||
const my = mskNow.getUTCFullYear()
|
||||
const mm = mskNow.getUTCMonth()
|
||||
const md = mskNow.getUTCDate()
|
||||
const mskMidnight = (y: number, m: number, d: number) =>
|
||||
new Date(Date.UTC(y, m, d) - MSK_OFFSET_MS).toISOString()
|
||||
|
||||
if (range === 'today') {
|
||||
timeMin = new Date(now.getFullYear(), now.getMonth(), now.getDate()).toISOString()
|
||||
timeMax = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1).toISOString()
|
||||
timeMin = mskMidnight(my, mm, md)
|
||||
timeMax = mskMidnight(my, mm, md + 1)
|
||||
} else if (range === 'week') {
|
||||
timeMin = new Date(now.getFullYear(), now.getMonth(), now.getDate()).toISOString()
|
||||
timeMax = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 7).toISOString()
|
||||
timeMin = mskMidnight(my, mm, md)
|
||||
timeMax = mskMidnight(my, mm, md + 7)
|
||||
} else {
|
||||
// month — support year/month query params
|
||||
const targetYear = parseInt(searchParams.get('year') || String(now.getFullYear()))
|
||||
|
||||
Reference in New Issue
Block a user