Modules@robinpath/date
@robinpath/date
0.1.0PublicParse, format, manipulate, and compare dates and times
@robinpath/date
Parse, format, manipulate, and compare dates and times
Why use this module?
The date module lets you:
- Parse a date string and return its ISO representation
- Format a date using a pattern string
- Add a duration to a date
- Subtract a duration from a date
- Calculate the difference between two dates in a given unit
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/date
Quick Start
No credentials needed — start using it right away:
date.format $date "YYYY-MM-DD"
Available Functions
| Function | Description |
|---|---|
date.parse | Parse a date string and return its ISO representation |
date.format | Format a date using a pattern string |
date.add | Add a duration to a date |
date.subtract | Subtract a duration from a date |
date.diff | Calculate the difference between two dates in a given unit |
date.startOf | Get the start of a time period for a date |
date.endOf | Get the end of a time period for a date |
date.isAfter | Check if the first date is after the second date |
date.isBefore | Check if the first date is before the second date |
date.isBetween | Check if a date falls between two other dates (exclusive) |
date.toISO | Convert a date to an ISO 8601 string |
date.toUnix | Convert a date to a Unix timestamp (seconds since epoch) |
date.fromUnix | Convert a Unix timestamp (seconds) to an ISO date string |
date.dayOfWeek | Get the day of the week for a date (0 = Sunday, 6 = Saturday) |
date.daysInMonth | Get the number of days in the month of a given date |
Examples
Format a date using a pattern string
date.format $date "YYYY-MM-DD"
Add a duration to a date
date.add $date 5 "days"
Subtract a duration from a date
date.subtract $date 3 "months"
Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/date";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
date.format $date "YYYY-MM-DD"
`);
Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.0 | latest | yesterday |
Related Modules
utilities
1
@dev-tester/hello-world
v2.0.0dev-tester
Updated description
0 downloads
...
utilities
0
@robinpath/apollo
v0.1.1robinpath
Apollo module for RobinPath.
0 downloads
...
utilities
0
@robinpath/archive
v0.1.1robinpath
Create and extract .zip and .tar.gz file archives
0 downloads
...
utilities
0
@robinpath/assert
v0.1.1robinpath
Testing assertions: equal, deepEqual, truthy, falsy, type checks, includes, matches, throws, and more
0 downloads
...
Install
$ robinpath install @robinpath/date Version0.1.0
LicenseMIT
Unpacked Size7.5 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

