dmtrKovalenko / dmtrKovalenko/date-io
Improve documenation for quickly using this as a wrapper for other date libraries
- Dominant language
- TypeScript
- Stars
- 754
- Forks
- 92
- PR merge metrics
- No merged PRs in 30d
Description
I've read the README and I _think_ that this library may do what I want it to, but I'm not sure. If it does do what I think it does, I would love to help improve the README to make the potential clearer!
Here's what I'm looking for:
I want a wrapper around MomentJS, date-fns, dayjs, luxon, that allows me as a library author to use date-io in my library and then allow users of the library to install one of those four alternatives as a peer dependency, and the date functionality should just work.
So essentially, let's say I'm using MomentJS. I should be able to replace this code:
```
// my-logic-file.js
import moment from 'moment'
const now = moment().format('MMMM Do YYYY, h:mm:ss a')
console.log(now)
```
with something like this:
```
// custom-date-io.js
import dateio from 'dateio'
import moment from 'moment'
dateio.setup(moment)
export default dateio
```
```
// my-logic-file.js
import dateio from 'custom-date-io'
// I'm pretty sure this is the dateio format but not 100% sure
const now = dateio.date().format('fullDateTime12h')
console.log(now)
```
In the README, however, it appears that as a library author I have to choose one specific library for my users. For instance, the example in the readme chooses date-fns for its users here:
```
// you-awesome-lib/adapters/date-fns
export { default } from "@date-io/date-fns";
```
So perhaps what I'm looking for is not currently possible?
Thanks for building this and for taking a look at this issue!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.