postgres-interval 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +19 -0
- package/index.js +1 -1
- package/package.json +2 -1
package/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare namespace PostgresInterval {
|
|
2
|
+
export interface IPostgresInterval {
|
|
3
|
+
years?: number;
|
|
4
|
+
months?: number;
|
|
5
|
+
days?: number;
|
|
6
|
+
hours?: number;
|
|
7
|
+
minutes?: number;
|
|
8
|
+
seconds?: number;
|
|
9
|
+
milliseconds?: number;
|
|
10
|
+
|
|
11
|
+
toPostgres(): string;
|
|
12
|
+
|
|
13
|
+
toISO(): string;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare function PostgresInterval(raw: string): PostgresInterval.IPostgresInterval;
|
|
18
|
+
|
|
19
|
+
export = PostgresInterval;
|
package/index.js
CHANGED
|
@@ -27,7 +27,7 @@ PostgresInterval.prototype.toPostgres = function () {
|
|
|
27
27
|
// Account for fractional part of seconds,
|
|
28
28
|
// remove trailing zeroes.
|
|
29
29
|
if (property === 'seconds' && this.milliseconds) {
|
|
30
|
-
value = (value + this.milliseconds / 1000).toFixed(6).replace(
|
|
30
|
+
value = (value + this.milliseconds / 1000).toFixed(6).replace(/\.?0+$/, '')
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
return value + ' ' + property
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postgres-interval",
|
|
3
3
|
"main": "index.js",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"description": "Parse Postgres interval columns",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "bendrucker/postgres-interval",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"index.js",
|
|
33
|
+
"index.d.ts",
|
|
33
34
|
"readme.md"
|
|
34
35
|
]
|
|
35
36
|
}
|