1.0.0 • Published 8 years ago

is-timestamp v1.0.0

Weekly downloads
56
License
MIT
Repository
github
Last release
8 years ago

is-timestamp

Checks if a value is a timestamp

Install

$ npm install is-timestamp

Usage

const isTimestamp = require('is-timestamp')

isTimestamp(new Date())
// => true

isTimestamp(1466421736923)
// => true

isTimestamp('1466421736923')
// => true

isTimestamp('1466421736923', true)
// => false (because strict mode on)

isTimestamp('foo')
// => false

Notes

This module works by default for both integers and strings. If you only want to use integers, use the strict mode:

isTimestamp('1466421736923', true)
// => false

License

MIT © François Chalifour