Socket
Socket
Sign inDemoInstall

postgres-interval

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postgres-interval - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

1

index.d.ts

@@ -15,2 +15,3 @@ declare namespace PostgresInterval {

toISOString(): string;
toISOStringShort(): string;
}

@@ -17,0 +18,0 @@ }

@@ -53,2 +53,10 @@ 'use strict'

PostgresInterval.prototype.toISOString = PostgresInterval.prototype.toISO = function () {
return toISOString.call(this, { short: false })
}
PostgresInterval.prototype.toISOStringShort = function () {
return toISOString.call(this, { short: true })
}
function toISOString ({ short = false }) {
const datePart = dateProperties

@@ -62,4 +70,8 @@ .map(buildProperty, this)

return 'P' + datePart + 'T' + timePart
if (!timePart.length && !datePart.length) return 'PT0S'
if (!timePart.length) return `P${datePart}`
return `P${datePart}T${timePart}`
function buildProperty (property) {

@@ -74,2 +86,4 @@ let value = this[property] || 0

if (short && !value) return ''
return value + propertiesISOEquivalent[property]

@@ -76,0 +90,0 @@ }

2

package.json
{
"name": "postgres-interval",
"main": "index.js",
"version": "2.0.0",
"version": "2.1.0",
"description": "Parse Postgres interval columns",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -48,8 +48,12 @@ # postgres-interval [![Build Status](https://travis-ci.org/bendrucker/postgres-interval.svg?branch=master)](https://travis-ci.org/bendrucker/postgres-interval)

Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string.
Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string, for example `P0Y0M0DT0H9M0S`.
Also available as `interval.toISO()` for backwards compatibility.
#### `interval.toISOStringShort()` -> `string`
Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string shortened to minimum length, for example `PT9M`.
## License
MIT © [Ben Drucker](http://bendrucker.me)
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