@cdellacqua/date-only
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

date-only

A DateOnly class for JavaScript

NPM Package

npm install @cdellacqua/date-only

Full documentation:

Highlights

Always serializes to YYYY-MM-DD

console.log(new DateOnly(2020, 0, 1).toString());
// -> 2020-01-01
console.log(new DateOnly(2020, 0, 1).toJSON());
// -> "2020-01-01"

Compatible with native Date object

console.log(DateOnly.fromDate(new Date(2020, 0, 1)).toString());
// -> 2020-01-01
console.log(new DateOnly(2020, 0, 1).toDate().toDateString());
// -> Wed Jan 01 2020

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.9
    7
    • latest

Version History

Package Sidebar

Install

npm i @cdellacqua/date-only

Weekly Downloads

7

Version

1.0.9

License

MIT

Unpacked Size

21.8 kB

Total Files

6

Last publish

Collaborators

  • cdellacqua