date-fns-reactified
Version:
date-fns but for vue composition-api
49 lines (34 loc) • 2.03 kB
Markdown
[](https://www.npmjs.com/package/date-fns-reactified)
[](https://github.com/fratzinger/date-fns-reactified/actions/workflows/node.js.yml?query=branch%3Amain++)
[](https://codeclimate.com/github/fratzinger/date-fns-reactified)
[](https://codeclimate.com/github/fratzinger/date-fns-reactified)
[](https://libraries.io/npm/date-fns-reactified)
[](https://www.npmjs.com/package/date-fns-reactified)
[](https://github.com/fratzinger/date-fns-reactified/blob/main/LICENSE)
This is meant as a replacement of [`date-fns`](https://github.com/date-fns/date-fns) for vue.js composition api with `Ref<>`. It uses [`reactify` from `@vueuse/core`](https://vueuse.org/shared/reactify/) all over the place.
```bash
npm i date-fns-reactified
```
instead of:
```typescript
import { addDays } from 'date-fns';
import { ref } from 'vue-demi';
const date = ref(new Date());
const days = ref(7);
const newDate = addDays(date.value, days.value)
```
do this:
```typescript
import { addDays } from 'date-fns-reactified';
import { ref } from 'vue-demi';
const date = ref(new Date());
const days = ref(7);
const newDate = addDays(date, days)
```
Simply run `npm test` and all your tests in the `test/` directory will be run. It has full support for *Visual Studio Code*. You can use the debugger to set breakpoints.
Licensed under the [MIT license](LICENSE).