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

chronoshift

Package Overview
Dependencies
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chronoshift - npm Package Compare versions

Comparing version 0.9.4 to 0.9.5

8

build/date-parser/date-parser.d.ts
import { Duration } from '../duration/duration';
import { Timezone } from '../timezone/timezone';
export declare function parseSQLDate(type: string, v: string): Date;
export declare function parseISODate(date: string, timezone?: Timezone): Date | null;
export declare function parseISODate(date: string, timezone?: Timezone): Date | undefined;
export interface IntervalParse {
computedStart: Date;
computedEnd: Date;
start?: Date | null;
end?: Date | null;
duration?: Duration | null;
start?: Date;
end?: Date;
duration?: Duration;
}
export declare function parseInterval(str: string, timezone?: Timezone, now?: Date): IntervalParse;

@@ -127,3 +127,3 @@ "use strict";

else {
return null;
return;
}

@@ -138,5 +138,5 @@ }

throw new Error("Can not parse string " + str);
var start = null;
var end = null;
var duration = null;
var start;
var end;
var duration;
var p0 = parts[0];

@@ -143,0 +143,0 @@ if (parts.length === 1) {

@@ -24,5 +24,5 @@ "use strict";

expect(date_parser_1.parseISODate('19700101Z'), 'non-hyphenated Unix epoch Z').toEqual(new Date(Date.UTC(1970, 0, 1, 0, 0, 0, 0)));
expect(date_parser_1.parseISODate('asdf'), 'invalid YYYY (non-digits)').toBeNull();
expect(date_parser_1.parseISODate('1970-as-df'), 'invalid YYYY-MM-DD (non-digits)').toBeNull();
expect(date_parser_1.parseISODate('1970-01-'), 'invalid YYYY-MM- (extra hyphen)').toBeNull();
expect(date_parser_1.parseISODate('asdf'), 'invalid YYYY (non-digits)').toBeUndefined();
expect(date_parser_1.parseISODate('1970-as-df'), 'invalid YYYY-MM-DD (non-digits)').toBeUndefined();
expect(date_parser_1.parseISODate('1970-01-'), 'invalid YYYY-MM- (extra hyphen)').toBeUndefined();
expect(date_parser_1.parseISODate('197001'), 'non-hyphenated year-month').toEqual(new Date(Date.UTC(1970, 0, 1, 0, 0, 0, 0)));

@@ -66,3 +66,3 @@ expect(date_parser_1.parseISODate('197001Z'), 'non-hyphenated year-month Z').toEqual(new Date(Date.UTC(1970, 0, 1, 0, 0, 0, 0)));

expect(date_parser_1.parseISODate('1970-01-01T00'), 'hour only time part').toEqual(new Date(Date.UTC(1970, 0, 1, 0, 0, 0, 0)));
expect(date_parser_1.parseISODate('1970-01-01T00:00.000'), 'invalid date-time (msec with missing seconds)').toBeNull();
expect(date_parser_1.parseISODate('1970-01-01T00:00.000'), 'invalid date-time (msec with missing seconds)').toBeUndefined();
});

@@ -69,0 +69,0 @@ it('date-time (tz = America/Los_Angeles)', function () {

@@ -37,4 +37,4 @@ import { Instance } from 'immutable-class';

getDescription(capitalize?: boolean): string;
getSingleSpan(): string | null;
getSingleSpanValue(): number | null;
getSingleSpan(): string | undefined;
getSingleSpanValue(): number | undefined;
}

@@ -286,8 +286,8 @@ "use strict";

Duration.prototype.getSingleSpan = function () {
return this.singleSpan || null;
return this.singleSpan;
};
Duration.prototype.getSingleSpanValue = function () {
if (!this.singleSpan)
return null;
return this.spans[this.singleSpan] || null;
return;
return this.spans[this.singleSpan];
};

@@ -294,0 +294,0 @@ return Duration;

@@ -294,5 +294,5 @@ "use strict";

durationStr = 'P3DT15H';
expect(duration_1.Duration.fromJS(durationStr).getSingleSpan()).toBeNull();
expect(duration_1.Duration.fromJS(durationStr).getSingleSpan()).toBeUndefined();
durationStr = 'P3DT15H';
expect(duration_1.Duration.fromJS(durationStr).getSingleSpan()).toBeNull();
expect(duration_1.Duration.fromJS(durationStr).getSingleSpan()).toBeUndefined();
});

@@ -312,7 +312,7 @@ });

durationStr = 'P3DT15H';
expect(duration_1.Duration.fromJS(durationStr).getSingleSpanValue()).toBeNull();
expect(duration_1.Duration.fromJS(durationStr).getSingleSpanValue()).toBeUndefined();
durationStr = 'P3DT15H';
expect(duration_1.Duration.fromJS(durationStr).getSingleSpanValue()).toBeNull();
expect(duration_1.Duration.fromJS(durationStr).getSingleSpanValue()).toBeUndefined();
});
});
});
{
"name": "chronoshift",
"version": "0.9.4",
"version": "0.9.5",
"description": "A tiny library for shifting time with timezones",

@@ -45,5 +45,4 @@ "keywords": [

"preset": "ts-jest",
"testEnvironment": "jsdom",
"testMatch": [
"**/?(*.)+(spec).ts?(x)"
"**/*.spec.ts"
],

@@ -50,0 +49,0 @@ "setupFilesAfterEnv": [

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