Files
teaching-feedback-assistant/utils/time.ts
shay7sev 0a07538dce feat: establish teaching feedback mini program
Connect student profiles, defaults, and feedback records to the Rust API. Configure the WeChat AppID, custom tab bar, and local development workflow for version 0.1.0.
2026-07-15 15:36:51 +08:00

16 lines
594 B
TypeScript

export function addMinutes(time: string, minutes: number): string {
const [hours, mins] = time.split(':').map(Number)
const total = (hours * 60 + mins + minutes) % (24 * 60)
const nextHours = Math.floor(total / 60)
const nextMinutes = total % 60
return `${String(nextHours).padStart(2, '0')}:${String(nextMinutes).padStart(2, '0')}`
}
export function formatUpdatedAt(timestamp: number): string {
const date = new Date(timestamp)
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
return `${hours}:${minutes}`
}