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

@wojtekmaj/date-utils

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wojtekmaj/date-utils - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

10

dist/cjs/index.d.ts

@@ -58,3 +58,3 @@ /**

export declare const getNextCenturyEnd: (date: string | number | Date, offset?: number) => Date;
export declare const getCenturyRange: (date: string | number | Date) => Date[];
export declare const getCenturyRange: (date: string | number | Date) => [Date, Date];
/**

@@ -69,3 +69,3 @@ * Decade

export declare const getNextDecadeEnd: (date: string | number | Date, offset?: number) => Date;
export declare const getDecadeRange: (date: string | number | Date) => Date[];
export declare const getDecadeRange: (date: string | number | Date) => [Date, Date];
/**

@@ -80,3 +80,3 @@ * Year

export declare const getNextYearEnd: (date: string | number | Date, offset?: number) => Date;
export declare const getYearRange: (date: string | number | Date) => Date[];
export declare const getYearRange: (date: string | number | Date) => [Date, Date];
export declare function getMonthStart(date: Date): Date;

@@ -88,3 +88,3 @@ export declare const getPreviousMonthStart: (date: Date, offset?: number) => Date;

export declare const getNextMonthEnd: (date: Date, offset?: number) => Date;
export declare const getMonthRange: (date: Date) => Date[];
export declare const getMonthRange: (date: Date) => [Date, Date];
export declare function getDayStart(date: Date): Date;

@@ -96,3 +96,3 @@ export declare const getPreviousDayStart: (date: Date, offset?: number) => Date;

export declare const getNextDayEnd: (date: Date, offset?: number) => Date;
export declare const getDayRange: (date: Date) => Date[];
export declare const getDayRange: (date: Date) => [Date, Date];
/**

@@ -99,0 +99,0 @@ * Other

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

}
function makeGetRange(functions) {
function makeGetRange(getStart, getEnd) {
return function makeGetRangeInternal(date) {
return functions.map(function (fn) { return fn(date); });
return [getStart(date), getEnd(date)];
};

@@ -168,3 +168,3 @@ }

exports.getNextCenturyEnd = makeGetEdgeOfNeighbor(getYear, exports.getCenturyEnd, 100);
exports.getCenturyRange = makeGetRange([getCenturyStart, exports.getCenturyEnd]);
exports.getCenturyRange = makeGetRange(getCenturyStart, exports.getCenturyEnd);
/**

@@ -187,3 +187,3 @@ * Decade

exports.getNextDecadeEnd = makeGetEdgeOfNeighbor(getYear, exports.getDecadeEnd, 10);
exports.getDecadeRange = makeGetRange([getDecadeStart, exports.getDecadeEnd]);
exports.getDecadeRange = makeGetRange(getDecadeStart, exports.getDecadeEnd);
/**

@@ -205,3 +205,3 @@ * Year

exports.getNextYearEnd = makeGetEdgeOfNeighbor(getYear, exports.getYearEnd, 1);
exports.getYearRange = makeGetRange([getYearStart, exports.getYearEnd]);
exports.getYearRange = makeGetRange(getYearStart, exports.getYearEnd);
/**

@@ -235,3 +235,3 @@ * Month

exports.getNextMonthEnd = makeGetEdgeOfNeighborMonth(exports.getMonthEnd, 1);
exports.getMonthRange = makeGetRange([getMonthStart, exports.getMonthEnd]);
exports.getMonthRange = makeGetRange(getMonthStart, exports.getMonthEnd);
/**

@@ -267,3 +267,3 @@ * Day

exports.getNextDayEnd = makeGetEdgeOfNeighborDay(exports.getDayEnd, 1);
exports.getDayRange = makeGetRange([getDayStart, exports.getDayEnd]);
exports.getDayRange = makeGetRange(getDayStart, exports.getDayEnd);
/**

@@ -270,0 +270,0 @@ * Other

@@ -58,3 +58,3 @@ /**

export declare const getNextCenturyEnd: (date: string | number | Date, offset?: number) => Date;
export declare const getCenturyRange: (date: string | number | Date) => Date[];
export declare const getCenturyRange: (date: string | number | Date) => [Date, Date];
/**

@@ -69,3 +69,3 @@ * Decade

export declare const getNextDecadeEnd: (date: string | number | Date, offset?: number) => Date;
export declare const getDecadeRange: (date: string | number | Date) => Date[];
export declare const getDecadeRange: (date: string | number | Date) => [Date, Date];
/**

@@ -80,3 +80,3 @@ * Year

export declare const getNextYearEnd: (date: string | number | Date, offset?: number) => Date;
export declare const getYearRange: (date: string | number | Date) => Date[];
export declare const getYearRange: (date: string | number | Date) => [Date, Date];
export declare function getMonthStart(date: Date): Date;

@@ -88,3 +88,3 @@ export declare const getPreviousMonthStart: (date: Date, offset?: number) => Date;

export declare const getNextMonthEnd: (date: Date, offset?: number) => Date;
export declare const getMonthRange: (date: Date) => Date[];
export declare const getMonthRange: (date: Date) => [Date, Date];
export declare function getDayStart(date: Date): Date;

@@ -96,3 +96,3 @@ export declare const getPreviousDayStart: (date: Date, offset?: number) => Date;

export declare const getNextDayEnd: (date: Date, offset?: number) => Date;
export declare const getDayRange: (date: Date) => Date[];
export declare const getDayRange: (date: Date) => [Date, Date];
/**

@@ -99,0 +99,0 @@ * Other

@@ -16,5 +16,5 @@ /**

}
function makeGetRange(functions) {
function makeGetRange(getStart, getEnd) {
return function makeGetRangeInternal(date) {
return functions.map(function (fn) { return fn(date); });
return [getStart(date), getEnd(date)];
};

@@ -157,3 +157,3 @@ }

export var getNextCenturyEnd = makeGetEdgeOfNeighbor(getYear, getCenturyEnd, 100);
export var getCenturyRange = makeGetRange([getCenturyStart, getCenturyEnd]);
export var getCenturyRange = makeGetRange(getCenturyStart, getCenturyEnd);
/**

@@ -175,3 +175,3 @@ * Decade

export var getNextDecadeEnd = makeGetEdgeOfNeighbor(getYear, getDecadeEnd, 10);
export var getDecadeRange = makeGetRange([getDecadeStart, getDecadeEnd]);
export var getDecadeRange = makeGetRange(getDecadeStart, getDecadeEnd);
/**

@@ -192,3 +192,3 @@ * Year

export var getNextYearEnd = makeGetEdgeOfNeighbor(getYear, getYearEnd, 1);
export var getYearRange = makeGetRange([getYearStart, getYearEnd]);
export var getYearRange = makeGetRange(getYearStart, getYearEnd);
/**

@@ -221,3 +221,3 @@ * Month

export var getNextMonthEnd = makeGetEdgeOfNeighborMonth(getMonthEnd, 1);
export var getMonthRange = makeGetRange([getMonthStart, getMonthEnd]);
export var getMonthRange = makeGetRange(getMonthStart, getMonthEnd);
/**

@@ -252,3 +252,3 @@ * Day

export var getNextDayEnd = makeGetEdgeOfNeighborDay(getDayEnd, 1);
export var getDayRange = makeGetRange([getDayStart, getDayEnd]);
export var getDayRange = makeGetRange(getDayStart, getDayEnd);
/**

@@ -255,0 +255,0 @@ * Other

{
"name": "@wojtekmaj/date-utils",
"version": "1.1.2",
"version": "1.1.3",
"description": "A collection of date-related utilities.",

@@ -16,3 +16,3 @@ "main": "dist/cjs/index.js",

"jest": "jest",
"lint": "eslint src",
"lint": "eslint .",
"prepack": "yarn clean && yarn build",

@@ -48,5 +48,2 @@ "prettier": "prettier --check . --cache",

},
"resolutions": {
"semver@7.0.0": "^7.0.0"
},
"publishConfig": {

@@ -53,0 +50,0 @@ "access": "public"

@@ -30,3 +30,3 @@ [![npm](https://img.shields.io/npm/v/@wojtekmaj/date-utils.svg)](https://www.npmjs.com/package/@wojtekmaj/date-utils) ![downloads](https://img.shields.io/npm/dt/@wojtekmaj/date-utils.svg) [![CI](https://github.com/wojtekmaj/date-utils/workflows/CI/badge.svg)](https://github.com/wojtekmaj/date-utils/actions) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)

getYear(new Date(2019, 0, 1); // 2019
getYear(new Date(2019, 0, 1)); // 2019
```

@@ -43,3 +43,3 @@

getMonth(new Date(2019, 0, 1); // 0
getMonth(new Date(2019, 0, 1)); // 0
```

@@ -56,3 +56,3 @@

getMonthHuman(new Date(2019, 0, 1); // 1
getMonthHuman(new Date(2019, 0, 1)); // 1
```

@@ -69,3 +69,3 @@

getDate(new Date(2019, 0, 15); // 15
getDate(new Date(2019, 0, 15)); // 15
```

@@ -82,3 +82,3 @@

getHours(new Date(2019, 0, 15, 22, 41, 56); // 22
getHours(new Date(2019, 0, 15, 22, 41, 56)); // 22
getHours('22:41:56'); // 22

@@ -96,3 +96,3 @@ ```

getMinutes(new Date(2019, 0, 15, 22, 41, 56); // 41
getMinutes(new Date(2019, 0, 15, 22, 41, 56)); // 41
getMinutes('22:41:56'); // 41

@@ -110,3 +110,3 @@ ```

getSeconds(new Date(2019, 0, 15, 22, 41, 56); // 56
getSeconds(new Date(2019, 0, 15, 22, 41, 56)); // 56
getSeconds('22:41:56'); // 56

@@ -113,0 +113,0 @@ getSeconds('22:41:56.321'); // 56

@@ -22,5 +22,5 @@ /**

function makeGetRange<T>(functions: ((date: T) => Date)[]) {
return function makeGetRangeInternal(date: T) {
return functions.map((fn) => fn(date));
function makeGetRange<T>(getStart: (date: T) => Date, getEnd: (date: T) => Date) {
return function makeGetRangeInternal(date: T): [Date, Date] {
return [getStart(date), getEnd(date)];
};

@@ -195,3 +195,3 @@ }

export const getCenturyRange = makeGetRange([getCenturyStart, getCenturyEnd]);
export const getCenturyRange = makeGetRange(getCenturyStart, getCenturyEnd);

@@ -217,3 +217,3 @@ /**

export const getDecadeRange = makeGetRange([getDecadeStart, getDecadeEnd]);
export const getDecadeRange = makeGetRange(getDecadeStart, getDecadeEnd);

@@ -238,3 +238,3 @@ /**

export const getYearRange = makeGetRange([getYearStart, getYearEnd]);
export const getYearRange = makeGetRange(getYearStart, getYearEnd);

@@ -271,3 +271,3 @@ /**

export const getMonthRange = makeGetRange([getMonthStart, getMonthEnd]);
export const getMonthRange = makeGetRange(getMonthStart, getMonthEnd);

@@ -306,3 +306,3 @@ /**

export const getDayRange = makeGetRange([getDayStart, getDayEnd]);
export const getDayRange = makeGetRange(getDayStart, getDayEnd);

@@ -309,0 +309,0 @@ /**

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