新增管理师移动端前端模块

This commit is contained in:
2026-06-29 20:58:39 +08:00
parent 9cfaac3e18
commit 48c47fe3ff
78 changed files with 9276 additions and 5 deletions
+22
View File
@@ -0,0 +1,22 @@
import { describe, expect, it } from 'vitest'
import { endOfWeek, formatDate, monthGrid, startOfWeek, timeFromMinutes, minutesOfDay } from '@/utils/date'
describe('date utils', () => {
it('uses Monday as the first day of a week', () => {
expect(formatDate(startOfWeek('2026-06-28'))).toBe('2026-06-22')
expect(formatDate(endOfWeek('2026-06-28'))).toBe('2026-06-28')
})
it('builds a 42-cell month grid with surrounding days', () => {
const grid = monthGrid('2026-06-15')
expect(grid).toHaveLength(42)
expect(grid[0]).toEqual({ date: '2026-06-01', day: 1, isCurrentMonth: true })
expect(grid[41]).toEqual({ date: '2026-07-12', day: 12, isCurrentMonth: false })
})
it('converts time and minutes symmetrically', () => {
expect(minutesOfDay('13:45')).toBe(825)
expect(timeFromMinutes(825)).toBe('13:45')
})
})