Files
shiftcraft/app/utils/dateHelpers.ts
Clanker 36e0946ee4 feat: complete ShiftCraft — AI-powered shift scheduling SaaS
Complete implementation including:
- Landing page with hero, features, how-it-works, pricing
- Employee management (CRUD with soft delete)
- AI constraint parser (Anthropic Claude API)
- German labor law templates (ArbZG §3, §5, §9)
- HiGHS ILP solver for optimal fair schedules
- Schedule calendar result view (employee × date grid)
- Shift framework configuration (periods + shifts)
- Subscription tiers: Free / Pro / Business
- PocketBase setup script with collection creation + seed data
- .env.example with all required variables documented

Pages: employees, constraints (list/new/templates), schedules (list/new/[id]),
       settings (organization/shifts/billing), dashboard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 07:47:31 +02:00

43 lines
1.3 KiB
TypeScript

export function formatDate(date: string | Date): string {
return new Intl.DateTimeFormat('de-DE', { dateStyle: 'medium' }).format(new Date(date))
}
export function formatDateShort(date: string | Date): string {
return new Intl.DateTimeFormat('de-DE', { day: '2-digit', month: '2-digit' }).format(new Date(date))
}
export function getDaysInRange(start: string, end: string): string[] {
const days: string[] = []
const current = new Date(start)
const endDate = new Date(end)
while (current <= endDate) {
days.push(current.toISOString().split('T')[0])
current.setDate(current.getDate() + 1)
}
return days
}
export function getWeekday(date: string): number {
const d = new Date(date)
return (d.getDay() + 6) % 7 // 0=Mon, 6=Sun
}
export function isWeekend(date: string): boolean {
const day = getWeekday(date)
return day === 5 || day === 6
}
export function addDays(date: string, days: number): string {
const d = new Date(date)
d.setDate(d.getDate() + days)
return d.toISOString().split('T')[0]
}
export function getWeekdayName(date: string): string {
return new Intl.DateTimeFormat('de-DE', { weekday: 'short' }).format(new Date(date))
}
export function getMonthName(date: string): string {
return new Intl.DateTimeFormat('de-DE', { month: 'long', year: 'numeric' }).format(new Date(date))
}