1.0.4 • Published 1 year ago

@domoskanonos/date-util v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

date-util

useful methods for Date class, f.e. convert date object in string and vice versa.

project info
npmLicence npm version minified size minzipped size downloads/week
githubPublished on git build
donationdonate

convert date object to string

const dateUtil: DateUtil = new DateUtil();
const dateExample = new Date("December 17, 1995 03:24:37");
const dateExampleAsString = dateUtil.formatDate(compareDate, "yyyy-MM-dd");
console.log(dateExampleAsString); // output -> 1995-12-17;

convert string to date object

const dateUtil: DateUtil = new DateUtil();
const dateExample : Date = dateUtil.parseDate("1995-12-17 03:24 37", "yyyy-MM-dd hh:mm ss");

diff dates

const dateUtil: DateUtil = new DateUtil();
dateUtil.diffDays(new Date(2013, 11, 31), new Date(2013, 12, 1)); // output -> 1

replace table for string input

  • d - day
  • y,Y - year
  • M - month
  • h,H - hours
  • m - Minute
  • s - Second
  • S - Milisecond
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago