Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

date-duration

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-duration - npm Package Compare versions

Comparing version 1.8.1 to 2.0.0

index.js

40

package.json
{
"name": "date-duration",
"version": "1.8.1",
"version": "2.0.0",
"description": "Manipulate Date objects with ISO 8601-formatted durations",
"main": "dist/duration.js",
"module": "src/duration.js",
"type": "module",
"exports": "./index.js",
"scripts": {
"lint": "eslint src test",
"build": "babel --source-maps -d dist src",
"test-timezone1": "export TZ=Europe/Brussels && mocha --require @babel/register",
"test-timezone2": "export TZ=America/New_York && mocha --require @babel/register",
"lint": "eslint index.js test",
"test-timezone1": "export TZ=Europe/Brussels && mocha",
"test-timezone2": "export TZ=America/New_York && mocha",
"test": "npm run test-timezone1 && npm run test-timezone2",
"clean": "rm -rf dist",
"preversion": "npm run lint && npm run test",
"postversion": "git push && git push --tags",
"prepublishOnly": "npm run lint && npm run test && npm run build",
"postpublish": "npm run clean"
"prepublishOnly": "npm run lint && npm run test"
},

@@ -39,19 +36,14 @@ "repository": {

"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"eslint": "^6.2.2",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"mocha": "^6.2.0"
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0",
"mocha": "^9.1.1"
},
"dependencies": {
"@babel/runtime": "^7.5.5",
"debug": ">=3.2.6 || >= 4.1.1"
"debug": "^4.3.2"
},
"node": "^12.20.0 || ^14.13.1 || >=16.0.0",
"browserslist": [

@@ -58,0 +50,0 @@ "last 1 version",

9

README.md

@@ -1,2 +0,2 @@

date-duration [![Build status](https://api.travis-ci.org/smhg/date-duration.png)](https://travis-ci.org/smhg/date-duration)
date-duration [![ci](https://github.com/smhg/date-duration/actions/workflows/node.js.yml/badge.svg)](https://github.com/smhg/date-duration/actions/workflows/node.js.yml)
======

@@ -18,3 +18,8 @@ Manipulate Date objects with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations)-formatted durations.

```
**Note:** keep in mind that working with time-only durations (hours, minutes, seconds) is _generally_ a better idea.
A duration of `PT36H` is not the same as `P1DT12H`. The former will add/subtract _exactly_ 36 hours while the latter will add 12 hours + whatever 1 day means. e.g. if jumping across DST (Daylight saving time) and the difference is 1 hour, this totals to plus/minus 35 hours or 37 hours.
This is generally what you want as long as you take into account this happens _within the context of the timezone of your environment_. **This can become tricky when used in browsers** (where you don't have control over this).
## API

@@ -37,2 +42,2 @@ ### Duration(ISOString)

### duration.toString()
Convert a duration back to a string in ISO 8601 format.
Convert a duration to a string in ISO 8601 format.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc