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

@journeyapps/core-date

Package Overview
Dependencies
Maintainers
2
Versions
248
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@journeyapps/core-date - npm Package Compare versions

Comparing version 0.0.0-dev.e75b697.aeec42f to 0.0.0-dev.f85da33.f99c1d5

dist/@types/src/DayConstructorInterface.d.ts

19

dist/@types/src/Day.d.ts

@@ -1,17 +0,2 @@

export declare class Day {
static today(): Day;
static fromUTCDate(date: Date): Day;
private _time;
constructor(arg1?: Date | Day | string | number, month?: number, day?: number);
toDate(): Date;
toString(): string;
toJSON(): string;
toISOString(): string;
valueOf(): number;
startOfDay(): Date;
endOfDay(): Date;
getYear(): number;
getMonth(): number;
getDay(): number;
getDayOfWeek(): number;
}
import { DayConstructor } from './DayConstructorInterface';
export declare const Day: DayConstructor;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Day {
static today() {
return new Day();
exports.Day = function (...args) {
var date, dateString, t;
if (args.length == 3) {
// new Day(year, month, day);
// month is 0-11.
this._time = new Date(Date.UTC(args[0], args[1], args[2]));
}
static fromUTCDate(date) {
return new Day(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
else if (args.length == 1 && args[0] instanceof Date) {
// new Day(new Date());
// Assume local timezone
date = args[0];
this._time = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
}
constructor(arg1, month, day) {
let date;
let dateString;
let t;
if (arguments.length == 3) {
// new Day(year, month, day);
// month is 0-11.
this._time = new Date(Date.UTC(arg1, month, day));
else if (args.length == 1 && args[0] instanceof exports.Day) {
// new Day(new Date());
this._time = args[0].toDate();
}
else if (args.length == 1 && typeof args[0] == 'string') {
// new Day("2014-02-15")
// new Day("2014-02-15T13:15")
// new Day("2014-02-15T13:15:11+02")
// new Day("2014-02-15T11:15:11Z")
dateString = args[0];
if (/^\d\d\d\d-\d\d-\d\d/.test(dateString)) {
this._time = new Date(dateString.substring(0, 10) + 'T00:00Z');
}
else if (arguments.length == 1 && arg1 instanceof Date) {
// new Day(new Date());
// Assume local timezone
date = arg1;
this._time = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
}
else if (arguments.length == 1 && arg1 instanceof Day) {
// new Day(new Date());
this._time = arg1.toDate();
}
else if (arguments.length == 1 && typeof arg1 == 'string') {
// new Day("2014-02-15")
// new Day("2014-02-15T13:15")
// new Day("2014-02-15T13:15:11+02")
// new Day("2014-02-15T11:15:11Z")
dateString = arg1;
if (/^\d\d\d\d-\d\d-\d\d/.test(dateString)) {
this._time = new Date(dateString.substring(0, 10) + 'T00:00Z');
}
else {
throw new Error('Invalid date format');
}
}
else if (arguments.length == 1 && typeof arg1 == 'number') {
// Assume UTC timestamp.
t = new Date(arg1);
if (t.getUTCHours() !== 0 ||
t.getUTCMinutes() !== 0 ||
t.getUTCSeconds() !== 0 ||
t.getUTCMilliseconds() !== 0) {
throw new Error('Invalid Day');
}
this._time = t;
}
else if (arguments.length === 0) {
// Today in local timezone
date = new Date();
this._time = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
}
else {
throw new Error('Invalid arguments for Day()');
throw new Error('Invalid date format');
}
}
toDate() {
// Clone the date, to prevent modifications from affecting us.
return new Date(this._time.getTime());
else if (args.length == 1 && typeof args[0] == 'number') {
// Assume UTC timestamp.
t = new Date(args[0]);
if (t.getUTCHours() !== 0 ||
t.getUTCMinutes() !== 0 ||
t.getUTCSeconds() !== 0 ||
t.getUTCMilliseconds() !== 0) {
throw new Error('Invalid Day');
}
this._time = t;
}
toString() {
return this._time.toISOString().substring(0, 10);
else if (args.length === 0) {
// Today in local timezone
date = new Date();
this._time = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
}
toJSON() {
return this.toString();
else {
throw new Error('Invalid args for Day()');
}
toISOString() {
return this.toString();
};
exports.Day.today = function () {
return new exports.Day();
};
exports.Day.fromUTCDate = function (date) {
return new exports.Day(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
};
exports.Day.isDay = function (obj) {
if (obj == null) {
return false;
}
valueOf() {
return this._time.getTime();
else if (obj instanceof exports.Day) {
return true;
}
startOfDay() {
var t = this._time;
var d = new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
return d;
else if (typeof obj == 'object') {
// This covers other implementations of the Day class, e.g. in the case
// of duplicate imports.
return (typeof obj.startOfDay == 'function' && typeof obj.endOfDay == 'function');
}
endOfDay() {
var t = this._time;
var d = new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate(), 23, 59, 59, 999);
return d;
else {
return false;
}
getYear() {
return this._time.getUTCFullYear();
}
getMonth() {
return this._time.getUTCMonth();
}
getDay() {
return this._time.getUTCDate();
}
getDayOfWeek() {
return this._time.getUTCDay();
}
;
}
exports.Day = Day;
};
let DayPrototype = exports.Day.prototype;
DayPrototype.toDate = function () {
// Clone the date, to prevent modifications from affecting us.
return new Date(this._time.getTime());
};
DayPrototype.toString = function () {
return this._time.toISOString().substring(0, 10);
};
DayPrototype.toJSON = function () {
return this.toString();
};
DayPrototype.toISOString = function () {
return this.toString();
};
DayPrototype.valueOf = function () {
return this._time.getTime();
};
DayPrototype.startOfDay = function () {
var t = this._time;
var d = new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
return d;
};
DayPrototype.endOfDay = function () {
var t = this._time;
var d = new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate(), 23, 59, 59, 999);
return d;
};
DayPrototype.getYear = function () {
return this._time.getUTCFullYear();
};
DayPrototype.getMonth = function () {
return this._time.getUTCMonth();
};
DayPrototype.getDay = function () {
return this._time.getUTCDate();
};
DayPrototype.getDayOfWeek = function () {
return this._time.getUTCDay();
};
//# sourceMappingURL=Day.js.map
{
"name": "@journeyapps/core-date",
"version": "0.0.0-dev.e75b697.aeec42f",
"version": "0.0.0-dev.f85da33.f99c1d5",
"description": "Journey JS library",

@@ -14,3 +14,3 @@ "main": "./dist/src/index.js",

"devDependencies": {
"@journeyapps/core-test-helpers": "0.0.0-dev.e75b697.aeec42f"
"@journeyapps/core-test-helpers": "0.0.0-dev.f85da33.f99c1d5"
},

@@ -21,3 +21,3 @@ "files": [

],
"gitHead": "083e0e6efde58efa4fb04cdcb64ea284cdde8011"
"gitHead": "aca57f421ef9cdf1e9291cd2c44bd75a16483908"
}

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