Skip to content

npm module for converting timestamps to time ago/until strings

Notifications You must be signed in to change notification settings

ikejs/nice-dates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nice-dates

Date formatter with more date methods!

alt text alt text alt text

Installation

npm i nice-dates --save

Date Formatting

const { timeAgoUntil } = require('nice-dates');

timeAgoUntil(new Date('2020-11-08T07:00:00.000Z')) // just now
timeAgoUntil(new Date('2020-11-08T06:59:32.000Z')) // 28 seconds ago
timeAgoUntil(new Date('2020-11-07T04:23:15.000Z')) // yesterday
timeAgoUntil(new Date('2020-11-11T02:15:07.000Z')) // 3 days from now
timeAgoUntil(new Date('2020-11-09T04:23:15.000Z')) // tomorrow
timeAgoUntil(new Date('2018-10-08T04:23:15.000Z')) // 2 years ago

Methods

  • timeAgoUntil(<date>) Returns the time ago/until the date.

  • consecutiveDates(<date>, <repeat>, <offset>) Returns an array of consecutive dates with an offset for each day.

  • orderDates([<dates>]) Puts a list of dates in order.

  • pastPresentFuture([<dates>]) Returns an object with arrays for past, present and future dates.

About

npm module for converting timestamps to time ago/until strings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published