@bemoje/date 0.2.5 → 0.2.7
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/package.json +2 -3
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/lib/dateAdjustHoursBy.d.ts +7 -0
- package/src/lib/dateAdjustHoursBy.js +14 -0
- package/src/lib/dateAdjustHoursBy.js.map +1 -0
- package/src/lib/dateCreateTimeZoneSetter.d.ts +6 -0
- package/src/lib/dateCreateTimeZoneSetter.js +16 -0
- package/src/lib/dateCreateTimeZoneSetter.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemoje/date",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Date related tools/util.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"scripts": {},
|
|
@@ -28,6 +28,5 @@
|
|
|
28
28
|
"homepage": "https://github.com/bemoje/tsmono",
|
|
29
29
|
"type": "commonjs",
|
|
30
30
|
"typings": "./src/index.d.ts",
|
|
31
|
-
"devDependencies": {}
|
|
32
|
-
"types": "./src/index.d.ts"
|
|
31
|
+
"devDependencies": {}
|
|
33
32
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export * from './lib/constants/MS_IN_MONTH';
|
|
|
9
9
|
export * from './lib/constants/MS_IN_SECOND';
|
|
10
10
|
export * from './lib/constants/MS_IN_WEEK';
|
|
11
11
|
export * from './lib/constants/MS_IN_YEAR';
|
|
12
|
+
export * from './lib/dateAdjustHoursBy';
|
|
13
|
+
export * from './lib/dateCreateTimeZoneSetter';
|
|
12
14
|
export * from './lib/dateDaysAgo';
|
|
13
15
|
export * from './lib/dateWeekDayName';
|
|
14
16
|
export * from './lib/daysSinceDate';
|
package/src/index.js
CHANGED
|
@@ -12,6 +12,8 @@ tslib_1.__exportStar(require("./lib/constants/MS_IN_MONTH"), exports);
|
|
|
12
12
|
tslib_1.__exportStar(require("./lib/constants/MS_IN_SECOND"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./lib/constants/MS_IN_WEEK"), exports);
|
|
14
14
|
tslib_1.__exportStar(require("./lib/constants/MS_IN_YEAR"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./lib/dateAdjustHoursBy"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./lib/dateCreateTimeZoneSetter"), exports);
|
|
15
17
|
tslib_1.__exportStar(require("./lib/dateDaysAgo"), exports);
|
|
16
18
|
tslib_1.__exportStar(require("./lib/dateWeekDayName"), exports);
|
|
17
19
|
tslib_1.__exportStar(require("./lib/daysSinceDate"), exports);
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/date/src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAqC;AACrC,mEAAwC;AACxC,qEAA0C;AAC1C,oEAAyC;AACzC,oEAAyC;AACzC,qEAA0C;AAC1C,uEAA4C;AAC5C,sEAA2C;AAC3C,uEAA4C;AAC5C,qEAA0C;AAC1C,qEAA0C;AAC1C,4DAAiC;AACjC,gEAAqC;AACrC,8DAAmC;AACnC,2DAAgC;AAChC,+DAAoC;AACpC,+DAAoC;AACpC,2DAAgC;AAChC,iEAAsC;AACtC,4EAAiD;AACjD,4DAAiC;AACjC,+DAAoC;AACpC,iEAAsC;AACtC,gEAAqC;AACrC,iEAAsC;AACtC,gEAAqC;AACrC,4DAAiC;AACjC,+DAAoC;AACpC,oEAAyC;AACzC,iEAAsC;AACtC,+DAAoC;AACpC,+DAAoC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/date/src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAqC;AACrC,mEAAwC;AACxC,qEAA0C;AAC1C,oEAAyC;AACzC,oEAAyC;AACzC,qEAA0C;AAC1C,uEAA4C;AAC5C,sEAA2C;AAC3C,uEAA4C;AAC5C,qEAA0C;AAC1C,qEAA0C;AAC1C,kEAAuC;AACvC,yEAA8C;AAC9C,4DAAiC;AACjC,gEAAqC;AACrC,8DAAmC;AACnC,2DAAgC;AAChC,+DAAoC;AACpC,+DAAoC;AACpC,2DAAgC;AAChC,iEAAsC;AACtC,4EAAiD;AACjD,4DAAiC;AACjC,+DAAoC;AACpC,iEAAsC;AACtC,gEAAqC;AACrC,iEAAsC;AACtC,gEAAqC;AACrC,4DAAiC;AACjC,+DAAoC;AACpC,oEAAyC;AACzC,iEAAsC;AACtC,+DAAoC;AACpC,+DAAoC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adjusts the given date by the specified number of hours.
|
|
3
|
+
* @param date - The date to adjust, represented as an integer or Date instance.
|
|
4
|
+
* @param hours - The number of hours. Decimal points and negative values are accepted.
|
|
5
|
+
* @returns The adjusted date, represented as a number.
|
|
6
|
+
*/
|
|
7
|
+
export declare function dateAdjustHoursBy(date: number | Date, hours: number): number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateAdjustHoursBy = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Adjusts the given date by the specified number of hours.
|
|
6
|
+
* @param date - The date to adjust, represented as an integer or Date instance.
|
|
7
|
+
* @param hours - The number of hours. Decimal points and negative values are accepted.
|
|
8
|
+
* @returns The adjusted date, represented as a number.
|
|
9
|
+
*/
|
|
10
|
+
function dateAdjustHoursBy(date, hours) {
|
|
11
|
+
return Math.floor(date.valueOf() + 1000 * 60 * 60 * hours);
|
|
12
|
+
}
|
|
13
|
+
exports.dateAdjustHoursBy = dateAdjustHoursBy;
|
|
14
|
+
//# sourceMappingURL=dateAdjustHoursBy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateAdjustHoursBy.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/dateAdjustHoursBy.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,IAAmB,EAAE,KAAa;IAClE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,CAAA;AAC5D,CAAC;AAFD,8CAEC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that adjusts the time zone of a given date object by a specified number of hours.
|
|
3
|
+
* @param hours - The distance from UTC time.
|
|
4
|
+
* @returns A function that takes a date-instance or date-integer and adjusts it by the given number of hours, and returns it as a date-integer.
|
|
5
|
+
*/
|
|
6
|
+
export declare function dateCreateTimeZoneSetter(hours: number): (date: number | Date) => number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateCreateTimeZoneSetter = void 0;
|
|
4
|
+
const dateAdjustHoursBy_1 = require("./dateAdjustHoursBy");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a function that adjusts the time zone of a given date object by a specified number of hours.
|
|
7
|
+
* @param hours - The distance from UTC time.
|
|
8
|
+
* @returns A function that takes a date-instance or date-integer and adjusts it by the given number of hours, and returns it as a date-integer.
|
|
9
|
+
*/
|
|
10
|
+
function dateCreateTimeZoneSetter(hours) {
|
|
11
|
+
return function setTimeZone(date) {
|
|
12
|
+
return (0, dateAdjustHoursBy_1.dateAdjustHoursBy)(date, hours);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.dateCreateTimeZoneSetter = dateCreateTimeZoneSetter;
|
|
16
|
+
//# sourceMappingURL=dateCreateTimeZoneSetter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateCreateTimeZoneSetter.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/dateCreateTimeZoneSetter.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AAEvD;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,KAAa;IACpD,OAAO,SAAS,WAAW,CAAC,IAAmB;QAC7C,OAAO,IAAA,qCAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACvC,CAAC,CAAA;AACH,CAAC;AAJD,4DAIC"}
|