Hi @icambron,
About a year ago our team picked Luxon as the standard date lib we would use across all projects. However, we use Ramda and Ramda Adjunct extensively and love to leverage the FP style. With Ramda we standardized usage by wrapping those libs in a single, extensible package, Phi, now open source.
When adopting Luxon, we hit the same issue as @sporto here: https://github.com/moment/luxon/issues/90.
To solve this, we wrote a wrapper lib to expose the entire Luxon API in the FP style with data-last, curried methods. I'm happy to say this project is now open source at
https://github.com/meltwater/tau
with docs at https://tau.meltwaterlabs.com/. This allows one to write code like
import { pipe, gt } from '@meltwater/phi'
import { fromIso, diffNow, days } from '@meltwater/tau'
const isIsoMoreThanNDaysOld = n => pipe(
fromIso,
diffNow('days'),
days,
gt(-n)
)
const isIsoMoreThan3DaysOld = isIsoMoreThanNDaysOld(3)
isIsoMoreThan3DaysOld('2018-01-24T20:27:49.288Z') //=> true
This project :heart:'s Luxon so we'd love any feedback you or your users might have.
(Also, if you would prefer this issue closed and discussion moved to an issue on our project, let me know. I cross posted here for visibility to Luxon contributors.)
Very cool.
I'm a big FP fan and a heavy Ramda user. I ultimately opted to keep Moment's basic design, but I'd always thought about wrapping Luxon like this.
I'll link this somewhere on the website.
Closing in favor of #446
Most helpful comment
Very cool.
I'm a big FP fan and a heavy Ramda user. I ultimately opted to keep Moment's basic design, but I'd always thought about wrapping Luxon like this.
I'll link this somewhere on the website.