Date utilities
Local calendar-day arithmetic for Calendar and date range controls.
Local calendar-day arithmetic and inclusive bounds without UTC day conversion.
Free (MIT)Version 1.0.0Released 27 Oct 2026iOS and Android
When to use it
- Share local calendar-day arithmetic across date and range pickers.
When not to use it
- Use a separate application time-zone model for instants and zoned appointments.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add date-utils- Adds
components/swipeui/lib/date-utils.ts.
Usage
import { addDays, addMonths, isDayAllowed } from '@/components/swipeui/lib/date-utils';
const tomorrow = addDays(new Date(), 1);
const nextMonth = addMonths(new Date(2024, 0, 31), 1); // February 29, 2024
const allowed = isDayAllowed(tomorrow, minDate, maxDate);Days use local year/month/day constructors. Month addition clamps to the destination's last day. Bounds are inclusive; monthGrid returns six full weeks. Do not derive local calendar days by truncating a UTC ISO string or adding a fixed 24-hour millisecond duration. Zoned appointments and instants belong to the application.
Accessibility
- This helper adds no accessibility behavior; the rendered component owns its semantics.
Motion
- Static on its own; any movement comes from the parent that animates it.
- No custom movement is configured by this item.
Performance
- Calendar grids contain 42 local days; helpers create no views or timers.
Notes for AI
- Use local day helpers for calendars; keep application-owned time zones and instants separate.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.