Date Schema
s.date()
Use the s.date() schema to represent dates (not datetime). Dates are stored as ISO 8601 date strings and automatically opt out of visual editing steganography.
Date values are stored as strings in ISO 8601 date format (e.g., 2024-03-15). This format ensures consistency and makes dates easy to parse and display.
Methods:
Custom validation function
Set a minimum date (inclusive)
Set a maximum date (inclusive)
Examples:
Basic usage
With date range validation
Using in components
Why use s.date() instead of s.string()?
While you could use s.string() for dates, s.date() provides several advantages:
Automatic steganography opt-out - Dates are automatically marked as
.raw(), preventing visual editing issuesBetter UI - Val Studio displays a date picker for easier editing
Type safety - Makes it clear that the field expects a date value
Consistent format - Ensures all dates follow ISO 8601 standard