@cleandns/whois-rdap 1.0.5 → 1.0.6
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/dist/index.js +4 -4
- package/package.json +3 -2
- package/src/index.ts +6 -6
package/dist/index.js
CHANGED
|
@@ -112,9 +112,9 @@ export async function whois(domain, options = { fetch: fetch }) {
|
|
|
112
112
|
// registrar
|
|
113
113
|
const { events, ...registrar } = registrars.sort((a, b) => {
|
|
114
114
|
var _a, _b;
|
|
115
|
-
const aDate = ((_a = a.events.find((ev) => ev.eventAction === "registration")) === null || _a === void 0 ? void 0 : _a.eventDate) || 0;
|
|
116
|
-
const bDate = ((_b = b.events.find((ev) => ev.eventAction === "registration")) === null || _b === void 0 ? void 0 : _b.eventDate) || 0;
|
|
117
|
-
return new Date(bDate
|
|
115
|
+
const aDate = (((_a = a.events.find((ev) => ev.eventAction === "registration")) === null || _a === void 0 ? void 0 : _a.eventDate) || 0).toString().replace(/\+0000Z$/, 'Z');
|
|
116
|
+
const bDate = (((_b = b.events.find((ev) => ev.eventAction === "registration")) === null || _b === void 0 ? void 0 : _b.eventDate) || 0).toString().replace(/\+0000Z$/, 'Z');
|
|
117
|
+
return new Date(bDate).valueOf() - new Date(aDate).valueOf();
|
|
118
118
|
})[0] || { id: 0, name: "" };
|
|
119
119
|
response.registrar = registrar;
|
|
120
120
|
// reseller
|
|
@@ -167,7 +167,7 @@ function findTimestamps(values) {
|
|
|
167
167
|
for (const [event, field] of eventMap) {
|
|
168
168
|
const date = events.find((ev) => ev.eventAction === event);
|
|
169
169
|
if (date === null || date === void 0 ? void 0 : date.eventDate) {
|
|
170
|
-
ts[field] = new Date(date.eventDate.replace(/\+0000Z$/, 'Z'));
|
|
170
|
+
ts[field] = new Date(date.eventDate.toString().replace(/\+0000Z$/, 'Z'));
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
return ts;
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleandns/whois-rdap",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc"
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"publish": "npm run build && npm version patch && npm publish"
|
|
9
10
|
},
|
|
10
11
|
"repository": {
|
|
11
12
|
"type": "git",
|
package/src/index.ts
CHANGED
|
@@ -156,12 +156,12 @@ export async function whois(domain: string, options: WhoisOptions = { fetch: fet
|
|
|
156
156
|
// registrar
|
|
157
157
|
const { events, ...registrar } = registrars.sort((a: any, b: any) => {
|
|
158
158
|
const aDate =
|
|
159
|
-
a.events.find((ev: any) => ev.eventAction === "registration")
|
|
160
|
-
?.eventDate || 0;
|
|
159
|
+
(a.events.find((ev: any) => ev.eventAction === "registration")
|
|
160
|
+
?.eventDate || 0).toString().replace(/\+0000Z$/, 'Z');
|
|
161
161
|
const bDate =
|
|
162
|
-
b.events.find((ev: any) => ev.eventAction === "registration")
|
|
163
|
-
?.eventDate || 0;
|
|
164
|
-
return new Date(bDate
|
|
162
|
+
(b.events.find((ev: any) => ev.eventAction === "registration")
|
|
163
|
+
?.eventDate || 0).toString().replace(/\+0000Z$/, 'Z');
|
|
164
|
+
return new Date(bDate).valueOf() - new Date(aDate).valueOf();
|
|
165
165
|
})[0] || { id: 0, name: "" };
|
|
166
166
|
response.registrar = registrar;
|
|
167
167
|
|
|
@@ -233,7 +233,7 @@ function findTimestamps(values: any[]) {
|
|
|
233
233
|
for (const [event, field] of eventMap) {
|
|
234
234
|
const date = events.find((ev: any) => ev.eventAction === event);
|
|
235
235
|
if (date?.eventDate) {
|
|
236
|
-
ts[field] = new Date(date.eventDate.replace(/\+0000Z$/, 'Z'));
|
|
236
|
+
ts[field] = new Date(date.eventDate.toString().replace(/\+0000Z$/, 'Z'));
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|