This commit is contained in:
gs committed 2026-09-26 01:09:06 +08:00
1 parent dc23ea53ed
commit 8c7a9040d2
106 files changed
+5668 -9910

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
export function formatTime(value?: string | null) {
if (!value) return '--'
const date = new Date(value)
return `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`
}
export function formatMinutes(minutes: number) {
const h = Math.floor(minutes / 60)
const m = minutes % 60
if (h <= 0) return `${m} 分钟`
if (m === 0) return `${h} 小时`
return `${h} 小时 ${m} 分钟`
}
export function recordLabel(type: string, sub?: string | null) {
if (type === 'feeding') {
const map: Record<string, string> = {
breastfeed: '亲喂',
bottle: '瓶喂',
formula: '配方奶',
mixed: '混合',
other: '其他'
}
return `喂奶 · ${map[sub || 'other'] || '其他'}`
}
if (type === 'sleep') return '睡眠'
if (type === 'excretion' && sub === 'pee') return '小便'
if (type === 'excretion' && sub === 'poop') return '大便'
return '记录'
}