@splitsecond/update

1.0.0 • Public • Published

@splitsecond/update

Updates an existing datetime string by adding or subtracting some units.

splitsecond is a simple date manipulation library for Node. This library always returns ISO 8601 datetime stamps in UTC.

Installation

npm i -S @splitsecond/update

or

yarn add @splitsecond/update

Usage

update(datetimestamp: string, units: Units): string

const update = require("@splitsecond/update");

// To add, specify the units as positive numbers
update("2020-03-26T20:41:15.791Z", { seconds: 4 });
// '2020-03-26T20:41:19.791Z'

// To subtract, specify them as negative numbers
update("2020-03-26T20:41:15.791Z", { minutes: -3 });
// '2020-03-26T20:38:15.791Z'

Units

{
  "milliseconds": 3,
  "seconds": 4,
  "minutes": -5,
  "hours": 1,
  "days": 1,
  "weeks": 0
}

Readme

Keywords

Package Sidebar

Install

npm i @splitsecond/update

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.51 kB

Total Files

4

Last publish

Collaborators

  • s14k51