Files
headroom/frontend/node_modules/fast-check/lib/esm/arbitrary/date.js
Santhosh Janardhanan de2d83092e feat: Reinitialize frontend with SvelteKit and TypeScript
- Delete old Vite+Svelte frontend
- Initialize new SvelteKit project with TypeScript
- Configure Tailwind CSS v4 + DaisyUI
- Implement JWT authentication with auto-refresh
- Create login page with form validation (Zod)
- Add protected route guards
- Update Docker configuration for single-stage build
- Add E2E tests with Playwright (6/11 passing)
- Fix Svelte 5 reactivity with $state() runes

Known issues:
- 5 E2E tests failing (timing/async issues)
- Token refresh implementation needs debugging
- Validation error display timing
2026-02-17 16:19:59 -05:00

21 lines
1.2 KiB
JavaScript

import { safeGetTime } from '../utils/globals.js';
import { integer } from './integer.js';
import { timeToDateMapper, timeToDateMapperWithNaN, timeToDateUnmapper, timeToDateUnmapperWithNaN, } from './_internals/mappers/TimeToDate.js';
const safeNumberIsNaN = Number.isNaN;
export function date(constraints = {}) {
const intMin = constraints.min !== undefined ? safeGetTime(constraints.min) : -8640000000000000;
const intMax = constraints.max !== undefined ? safeGetTime(constraints.max) : 8640000000000000;
const noInvalidDate = constraints.noInvalidDate === undefined || constraints.noInvalidDate;
if (safeNumberIsNaN(intMin))
throw new Error('fc.date min must be valid instance of Date');
if (safeNumberIsNaN(intMax))
throw new Error('fc.date max must be valid instance of Date');
if (intMin > intMax)
throw new Error('fc.date max must be greater or equal to min');
if (noInvalidDate) {
return integer({ min: intMin, max: intMax }).map(timeToDateMapper, timeToDateUnmapper);
}
const valueForNaN = intMax + 1;
return integer({ min: intMin, max: intMax + 1 }).map(timeToDateMapperWithNaN(valueForNaN), timeToDateUnmapperWithNaN(valueForNaN));
}