0.9.10 • Published 3 years ago

@taystack/get-date v0.9.10

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Javascript getDate

codecov npm

Documentation

Play on Runkit

Why?

Moment.js has been retired. It had math operations on dates. I think Math is helpful on Dates.

With moment

import moment from 'moment'
const now = Date.now()
const today = moment.utc(now)
const momentYesterday = today.subtract(1, 'days')

With @taystack/getDate:

import { getDate, subtractDays } from '@taystack/get-date' // es6
// const { getDate, subtractDays } = require('@taystack/get-date') // es5
const now = Date.now()
const today = getDate(now)
const getDateYesterday = subtractDays(now, 1)

What else?

There are no dependencies. This is a small set of helpers for working with native Javascript Date objects.

Installation

npm i @taystack/get-date

API

Getters

getDate

getDate documentation

import { getDate } from '@taystack/get-date'
getDate()
// Same as new Date()
getDate(0)
// new Date(0) -> jan 1 1970

getTime

getTime documentation

import { getTime } from '@taystack/get-date'
getTime()
// Same as Date.now()
getTime(0)
// 0 -> Short-hand new Date(0).getTime()
0.9.10

3 years ago

0.9.8

3 years ago

0.9.7

3 years ago

0.9.9

3 years ago

0.9.6

3 years ago

0.9.4

3 years ago

0.9.5

3 years ago

0.9.3

3 years ago

0.9.2

3 years ago

0.9.0

3 years ago

0.9.1

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago