Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Latest commit

 

History

History
99 lines (63 loc) · 1.03 KB

README.md

File metadata and controls

99 lines (63 loc) · 1.03 KB

Momento

Immutable moment.js with composable functions and partial application of data

Installation

$ npm install momento

Example with Ramda pipe

const nextWeek = pipe(
  parse('DD/MM/YYYY'),
  add('days', 7),
  format('DD/MM/YYYY')
)

nextWeek('10/12/2017')

Functions

add

Same as moment.add()

add('days', 2, now())

format

Same as moment.format()

format('DD/MM/YYYY', now())

getMilliseconds

Same as moment.milliseconds()

getMilliseconds(now())

getSeconds

Same as moment.seconds()

getSeconds(now())

now

Same as moment() without arguments

now()

parse

Same as moment() with two arguments

parse('DD/MM/YYYY', '31/10/1993')

parseISO

Same as moment() with one argument

parseISO('1993-10-31')

parseUnix

Same as moment.unix()

parseUnix(752041500)

subtract

Same as moment.subtract()

subtract('days', 2, now())

Missing a function?

Fell free to send a Pull Request! ❤️