Skip to content

timerg/rescript-dayjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rescript-dayjs

This is Rescript binding for Dayjs. While the bindings for Plugins are still work in progress, it should be enough in most circumstances.

Install

yarn add @ggteven/rescript-dayjs
or
npm install @ggteven/rescript-dayjs

Add rescript-dayjs to bs-dependencies

"bs-dependencies": [
    ...
    "@ggteven/rescript-dayjs"
  ],

Example

You can find usage exmples in the test folder

Plugins

Extend the plugin like in js. The extend and the usage should be in the same file

Day.extend(Day_UTC.plugin)
Day_UTC.utc()

While bindings for many plugins are still work inprogress, you can bind your own plugin and give it a plugin type. Then give it to the extend function. All should happen in a same file

@module
external plugin: Day.plugin = "dayjs/plugin/isToday"

@send
external isToday: (Day.dayjs, unit) => bool = "isToday"

Day.extend(plugin)
Day.now()->isToday // true

Check Dayjs documentation for available props.

About

A rescript binding for dayjs

Resources

License

Stars

Watchers

Forks

Packages

No packages published