Skip to content

hypersoftllc/qc-immutable_date

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qc-immutable_date

Build Status Coverage Status License Downloads

npm badge

An immutable version of a JavaScript Date.

Installation

npm install --save qc-immutable_date

Example Usage

import { ImmutableDate } from 'qc-immutable_date';

let d1 = new Date(946684800000); // Date on 2000-01-01T00:00:00.000 UTC
let id1 = new ImmutableDate(d1);
let id2 = id1.setFullYear(2010); // id1 is still in 2000
let d2 = id2.toDate();  // Date on 2010-01-01T00:00:00.000 UTC