Luxon: Tau: Luxon in the functional programming style

Created on 28 Jan 2019  路  2Comments  路  Source: moment/luxon

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.)

documentation

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.

All 2 comments

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

Was this page helpful?
0 / 5 - 0 ratings