New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@internetarchive/search-service

Package Overview
Dependencies
Maintainers
11
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internetarchive/search-service - npm Package Compare versions

Comparing version 0.0.1-alpha.6 to 0.0.1-alpha.7

9

dist/src/models/metadata-fields/field-parsers.js

@@ -36,3 +36,2 @@ export class NumberParser {

}
// uses javascript's `Date.parse()`, which handles many formats, including `c.a. 2020`
parseJSDate(rawValue) {

@@ -49,7 +48,5 @@ // fix for Safari not supporting `yyyy-mm-dd HH:MM:SS` format, insert a `T` into the space

// the `Date(string)` constructor parses some strings as GMT and some in the local timezone
// this attempts to detect cases that get parsed as GMT and adjust others accordingly
// this attempts to detect cases that get parsed as GMT and adjusts accordingly
const dateWithTimeZone = rawValue.indexOf('Z') > -1 || // ISO8601 with GMT timezone
rawValue.indexOf('+') > -1 || // ISO8601 with positive timezone offset
rawValue.indexOf('c.a.') > -1 || // c.a. 2020
rawValue.indexOf('ca') > -1 || // ca 2020
rawValue.match(/^[0-9]{4}$/) || // just the year, ie `2020`

@@ -59,4 +56,4 @@ rawValue.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/) || // YYYY-MM-DD format

rawValue.match(/^.*?-[0-9]{4}$/); // `YYYY-MM-DDTHH:mm:ss-0000` format
if (!dateWithTimeZone) {
date = new Date(date.getTime() - date.getTimezoneOffset() * 1000 * 60);
if (dateWithTimeZone) {
date = new Date(date.getTime() + date.getTimezoneOffset() * 1000 * 60);
}

@@ -63,0 +60,0 @@ return date;

@@ -33,9 +33,9 @@ import { expect } from '@open-wc/testing';

const expected = new Date();
expected.setUTCHours(0);
expected.setUTCMinutes(0);
expected.setUTCSeconds(0);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(5);
expected.setUTCDate(20);
expected.setUTCFullYear(2020);
expected.setHours(0);
expected.setMinutes(0);
expected.setSeconds(0);
expected.setMilliseconds(0);
expected.setMonth(5);
expected.setDate(20);
expected.setFullYear(2020);
expect(response === null || response === void 0 ? void 0 : response.getTime()).to.equal(expected.getTime());

@@ -49,9 +49,9 @@ expect(response2 === null || response2 === void 0 ? void 0 : response2.getTime()).to.equal(expected.getTime());

const expected = new Date();
expected.setUTCHours(3);
expected.setUTCMinutes(46);
expected.setUTCSeconds(23);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(5);
expected.setUTCDate(20);
expected.setUTCFullYear(2020);
expected.setHours(3);
expected.setMinutes(46);
expected.setSeconds(23);
expected.setMilliseconds(0);
expected.setMonth(5);
expected.setDate(20);
expected.setFullYear(2020);
expect(response === null || response === void 0 ? void 0 : response.getTime()).to.equal(expected.getTime());

@@ -64,9 +64,9 @@ expect(response2 === null || response2 === void 0 ? void 0 : response2.getTime()).to.equal(expected.getTime());

const expected = new Date();
expected.setUTCHours(5);
expected.setUTCMinutes(12);
expected.setUTCSeconds(38);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(8);
expected.setUTCDate(20);
expected.setUTCFullYear(2020);
expected.setHours(5);
expected.setMinutes(12);
expected.setSeconds(38);
expected.setMilliseconds(0);
expected.setMonth(8);
expected.setDate(20);
expected.setFullYear(2020);
expect(response === null || response === void 0 ? void 0 : response.getTime()).to.equal(expected.getTime());

@@ -81,9 +81,9 @@ });

const expected = new Date();
expected.setUTCHours(13);
expected.setUTCMinutes(37);
expected.setUTCSeconds(15);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(5);
expected.setUTCDate(20);
expected.setUTCFullYear(2020);
expected.setHours(13);
expected.setMinutes(37);
expected.setSeconds(15);
expected.setMilliseconds(0);
expected.setMonth(5);
expected.setDate(20);
expected.setFullYear(2020);
expect(response === null || response === void 0 ? void 0 : response.getTime()).to.equal(expected.getTime());

@@ -124,9 +124,9 @@ expect(response2 === null || response2 === void 0 ? void 0 : response2.getTime()).to.equal(expected.getTime());

const expected = new Date();
expected.setUTCHours(0);
expected.setUTCMinutes(0);
expected.setUTCSeconds(0);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(0);
expected.setUTCDate(1);
expected.setUTCFullYear(2020);
expected.setHours(0);
expected.setMinutes(0);
expected.setSeconds(0);
expected.setMilliseconds(0);
expected.setMonth(0);
expected.setDate(1);
expected.setFullYear(2020);
expect(response === null || response === void 0 ? void 0 : response.getTime()).to.equal(expected.getTime());

@@ -133,0 +133,0 @@ });

{
"name": "@internetarchive/search-service",
"version": "0.0.1-alpha.6",
"version": "0.0.1-alpha.7",
"description": "A search service for the Internet Archive",

@@ -5,0 +5,0 @@ "license": "AGPL-3.0-only",

@@ -48,3 +48,2 @@ /* eslint-disable class-methods-use-this */

// uses javascript's `Date.parse()`, which handles many formats, including `c.a. 2020`
private parseJSDate(rawValue: string): Date | undefined {

@@ -66,8 +65,6 @@ // fix for Safari not supporting `yyyy-mm-dd HH:MM:SS` format, insert a `T` into the space

// the `Date(string)` constructor parses some strings as GMT and some in the local timezone
// this attempts to detect cases that get parsed as GMT and adjust others accordingly
// this attempts to detect cases that get parsed as GMT and adjusts accordingly
const dateWithTimeZone =
rawValue.indexOf('Z') > -1 || // ISO8601 with GMT timezone
rawValue.indexOf('+') > -1 || // ISO8601 with positive timezone offset
rawValue.indexOf('c.a.') > -1 || // c.a. 2020
rawValue.indexOf('ca') > -1 || // ca 2020
rawValue.match(/^[0-9]{4}$/) || // just the year, ie `2020`

@@ -77,4 +74,4 @@ rawValue.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/) || // YYYY-MM-DD format

rawValue.match(/^.*?-[0-9]{4}$/); // `YYYY-MM-DDTHH:mm:ss-0000` format
if (!dateWithTimeZone) {
date = new Date(date.getTime() - date.getTimezoneOffset() * 1000 * 60);
if (dateWithTimeZone) {
date = new Date(date.getTime() + date.getTimezoneOffset() * 1000 * 60);
}

@@ -81,0 +78,0 @@ return date;

@@ -45,9 +45,9 @@ import { expect } from '@open-wc/testing';

const expected = new Date();
expected.setUTCHours(0);
expected.setUTCMinutes(0);
expected.setUTCSeconds(0);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(5);
expected.setUTCDate(20);
expected.setUTCFullYear(2020);
expected.setHours(0);
expected.setMinutes(0);
expected.setSeconds(0);
expected.setMilliseconds(0);
expected.setMonth(5);
expected.setDate(20);
expected.setFullYear(2020);
expect(response?.getTime()).to.equal(expected.getTime());

@@ -62,9 +62,9 @@ expect(response2?.getTime()).to.equal(expected.getTime());

const expected = new Date();
expected.setUTCHours(3);
expected.setUTCMinutes(46);
expected.setUTCSeconds(23);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(5);
expected.setUTCDate(20);
expected.setUTCFullYear(2020);
expected.setHours(3);
expected.setMinutes(46);
expected.setSeconds(23);
expected.setMilliseconds(0);
expected.setMonth(5);
expected.setDate(20);
expected.setFullYear(2020);
expect(response?.getTime()).to.equal(expected.getTime());

@@ -78,9 +78,9 @@ expect(response2?.getTime()).to.equal(expected.getTime());

const expected = new Date();
expected.setUTCHours(5);
expected.setUTCMinutes(12);
expected.setUTCSeconds(38);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(8);
expected.setUTCDate(20);
expected.setUTCFullYear(2020);
expected.setHours(5);
expected.setMinutes(12);
expected.setSeconds(38);
expected.setMilliseconds(0);
expected.setMonth(8);
expected.setDate(20);
expected.setFullYear(2020);
expect(response?.getTime()).to.equal(expected.getTime());

@@ -96,9 +96,9 @@ });

const expected = new Date();
expected.setUTCHours(13);
expected.setUTCMinutes(37);
expected.setUTCSeconds(15);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(5);
expected.setUTCDate(20);
expected.setUTCFullYear(2020);
expected.setHours(13);
expected.setMinutes(37);
expected.setSeconds(15);
expected.setMilliseconds(0);
expected.setMonth(5);
expected.setDate(20);
expected.setFullYear(2020);
expect(response?.getTime()).to.equal(expected.getTime());

@@ -142,9 +142,9 @@ expect(response2?.getTime()).to.equal(expected.getTime());

const expected = new Date();
expected.setUTCHours(0);
expected.setUTCMinutes(0);
expected.setUTCSeconds(0);
expected.setUTCMilliseconds(0);
expected.setUTCMonth(0);
expected.setUTCDate(1);
expected.setUTCFullYear(2020);
expected.setHours(0);
expected.setMinutes(0);
expected.setSeconds(0);
expected.setMilliseconds(0);
expected.setMonth(0);
expected.setDate(1);
expected.setFullYear(2020);
expect(response?.getTime()).to.equal(expected.getTime());

@@ -151,0 +151,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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