This commit is contained in:
@@ -76,6 +76,16 @@ export function numericHabitInputValue(input: number | string | undefined) {
|
||||
return Number.isFinite(value) && value >= 0 ? value : null
|
||||
}
|
||||
|
||||
export function countdownDayText(days: number) {
|
||||
if (days > 0) return `还有 ${days} 天`
|
||||
if (days === 0) return '就是今天'
|
||||
return `已经 ${Math.abs(days)} 天`
|
||||
}
|
||||
|
||||
export function countdownKindLabel(kind: string) {
|
||||
return ({ countdown: '倒数日', anniversary: '纪念日', birthday: '生日' } as Record<string, string>)[kind] ?? '倒数日'
|
||||
}
|
||||
|
||||
export function shouldToggleRowSwipe(deltaX: number, deltaY: number) {
|
||||
return deltaX >= 64 && deltaX > Math.abs(deltaY) * 1.5
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user