JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q43652F
  • License ISC

Date formatter with more date methods!

Package Exports

  • nice-dates

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nice-dates) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.