@ggteven/rescript-dayjs

1.0.2 • Public • Published

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.

Package Sidebar

Install

npm i @ggteven/rescript-dayjs

Weekly Downloads

16

Version

1.0.2

License

MIT

Unpacked Size

13.6 kB

Total Files

26

Last publish

Collaborators

  • ggteven