code-docs/plugins/operators/dayjs.md
Date and time operators using Day.js.
| Operator | Purpose |
|---|---|
_dayjs | Full Day.js operations |
_date | Simplified date operations |
Simple date operations:
# Current date/time
now:
_date: now
# Format current date
formatted:
_date:
- now
- format: YYYY-MM-DD
# Parse and format
displayDate:
_date:
- _state: dateString
- format: MMMM D, YYYY
# Add/subtract time
nextWeek:
_date:
- now
- add:
- 7
- days
Full Day.js API:
# Create dayjs instance
date:
_dayjs:
- '2024-01-15'
- YYYY-MM-DD
# Chain operations
result:
_dayjs:
on:
_state: startDate
operations:
- - add
- 1
- month
- - startOf
- month
- - format
- YYYY-MM-DD
| Token | Output |
|---|---|
YYYY | 2024 |
MM | 01-12 |
DD | 01-31 |
HH | 00-23 |
mm | 00-59 |
ss | 00-59 |
MMMM | January |
dddd | Monday |
ago:
_dayjs:
on:
_state: createdAt
operations:
- - fromNow
daysBetween:
_dayjs:
on:
_state: endDate
operations:
- - diff
- _state: startDate
- days
isAfter:
_dayjs:
on:
_state: date1
operations:
- - isAfter
- _state: date2
_moment renamed to _dayjs — simple find-and-replace in YAML configthresholds parameter on humanizeDuration is accepted but ignoreden-US → en)