reltime
Relative time representations with language support.
Features
- Expresses dates and times in natural, human-readable forms
- Supports relative (today, tomorrow), named (Monday, January), and exact representations
- Optional Swedish language support (enabled by default)
- JSON Schema generation via schemars
- Serialisation to natural JSON formats
CLI
The CLI converts time expressions to their earliest or latest possible timestamps.
Installation
Usage
Convert a time expression to its earliest timestamp:
Convert to the latest timestamp:
Specify a reference time:
Generate JSON Schema:
Schema Support
All types implement JsonSchema from the schemars crate. Generate a schema file for use with yaml-language-server or other schema-aware tools:
Example: Todo List with Schema
Create a todo.yaml with schema validation:
# yaml-language-server: $schema=./schema.json
---
- task: Review pull requests
due: Today
- task: Team meeting
due: "14:30"
- task: Deploy to production
due: Friday
- task: Q1 planning
due: January
Another example with exact dates:
# yaml-language-server: $schema=./schema.json
---
- task: Birthday present
due: "25/12" # 25th December (recurring)
- task: Project deadline
due: "15/3/2025 17:00" # 15th March 2025 at 5pm
- task: Morning standup
due: "09:00"
- task: End of sprint
due: ThisWeek
Language Support
By default, Swedish variants are available alongside English:
To disable Swedish support, compile without default features: