https://github.com/dckt/rescript-date-fns
Bindings for date-fns library
https://github.com/dckt/rescript-date-fns
Last synced: about 1 month ago
JSON representation
Bindings for date-fns library
- Host: GitHub
- URL: https://github.com/dckt/rescript-date-fns
- Owner: DCKT
- Created: 2024-02-17T16:53:15.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-17T17:02:37.000Z (about 1 year ago)
- Last Synced: 2025-02-11T13:27:09.838Z (3 months ago)
- Language: ReScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# rescript-date-fns
ReScript bindings for [date-fns](https://date-fns.org/) (targeted version : `~3.3.1`)
## Setup
1. Install the module
```bash
bun install @dck/rescript-date-fns
# or
yarn install @dck/rescript-date-fns
# or
npm install @dck/rescript-date-fns
```2. Add it to your `rescript.json` config
```json
{
"bsc-dependencies": ["@dck/rescript-date-fns"]
}
```## Usage
The functions can be accessed through `DateFns` module.
```rescript
let now = Js.Date.make()
let yesterday = now->DateFns.subDays(1)
let isoDate = "2024-02-17T16:59:23.164Z"Js.log(yesterday->DateFns.isYesterday) // true
Js.log(isoDate->DateFns.parseISO->DateFns.isValid) // true
```## Development
Install deps
```bash
bun install
```Compiles files
```bash
bun run dev
```Run tests
```bash
bun test
```