@bemoje/date 0.3.1 → 1.0.1
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/README.md +94 -20
- package/index.d.ts +90 -0
- package/index.mjs +112 -0
- package/package.json +23 -16
- package/LICENSE +0 -21
- package/cjs/index.d.ts +0 -38
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js +0 -41
- package/cjs/index.js.map +0 -1
- package/cjs/lib/assertValidDate.d.ts +0 -19
- package/cjs/lib/assertValidDate.d.ts.map +0 -1
- package/cjs/lib/assertValidDate.js +0 -36
- package/cjs/lib/assertValidDate.js.map +0 -1
- package/cjs/lib/assertValidDateDay.d.ts +0 -16
- package/cjs/lib/assertValidDateDay.d.ts.map +0 -1
- package/cjs/lib/assertValidDateDay.js +0 -24
- package/cjs/lib/assertValidDateDay.js.map +0 -1
- package/cjs/lib/assertValidDateMonth.d.ts +0 -13
- package/cjs/lib/assertValidDateMonth.d.ts.map +0 -1
- package/cjs/lib/assertValidDateMonth.js +0 -21
- package/cjs/lib/assertValidDateMonth.js.map +0 -1
- package/cjs/lib/assertValidDateYear.d.ts +0 -14
- package/cjs/lib/assertValidDateYear.d.ts.map +0 -1
- package/cjs/lib/assertValidDateYear.js +0 -22
- package/cjs/lib/assertValidDateYear.js.map +0 -1
- package/cjs/lib/constants/DAYS_IN_MONTH.d.ts +0 -5
- package/cjs/lib/constants/DAYS_IN_MONTH.d.ts.map +0 -1
- package/cjs/lib/constants/DAYS_IN_MONTH.js +0 -8
- package/cjs/lib/constants/DAYS_IN_MONTH.js.map +0 -1
- package/cjs/lib/constants/MS_IN_DAY.d.ts +0 -5
- package/cjs/lib/constants/MS_IN_DAY.d.ts.map +0 -1
- package/cjs/lib/constants/MS_IN_DAY.js +0 -8
- package/cjs/lib/constants/MS_IN_DAY.js.map +0 -1
- package/cjs/lib/constants/MS_IN_HOUR.d.ts +0 -5
- package/cjs/lib/constants/MS_IN_HOUR.d.ts.map +0 -1
- package/cjs/lib/constants/MS_IN_HOUR.js +0 -8
- package/cjs/lib/constants/MS_IN_HOUR.js.map +0 -1
- package/cjs/lib/constants/MS_IN_MINUTE.d.ts +0 -5
- package/cjs/lib/constants/MS_IN_MINUTE.d.ts.map +0 -1
- package/cjs/lib/constants/MS_IN_MINUTE.js +0 -8
- package/cjs/lib/constants/MS_IN_MINUTE.js.map +0 -1
- package/cjs/lib/constants/MS_IN_MONTH.d.ts +0 -5
- package/cjs/lib/constants/MS_IN_MONTH.d.ts.map +0 -1
- package/cjs/lib/constants/MS_IN_MONTH.js +0 -8
- package/cjs/lib/constants/MS_IN_MONTH.js.map +0 -1
- package/cjs/lib/constants/MS_IN_SECOND.d.ts +0 -5
- package/cjs/lib/constants/MS_IN_SECOND.d.ts.map +0 -1
- package/cjs/lib/constants/MS_IN_SECOND.js +0 -8
- package/cjs/lib/constants/MS_IN_SECOND.js.map +0 -1
- package/cjs/lib/constants/MS_IN_WEEK.d.ts +0 -5
- package/cjs/lib/constants/MS_IN_WEEK.d.ts.map +0 -1
- package/cjs/lib/constants/MS_IN_WEEK.js +0 -8
- package/cjs/lib/constants/MS_IN_WEEK.js.map +0 -1
- package/cjs/lib/constants/MS_IN_YEAR.d.ts +0 -5
- package/cjs/lib/constants/MS_IN_YEAR.d.ts.map +0 -1
- package/cjs/lib/constants/MS_IN_YEAR.js +0 -8
- package/cjs/lib/constants/MS_IN_YEAR.js.map +0 -1
- package/cjs/lib/dateAdjustHoursBy.d.ts +0 -8
- package/cjs/lib/dateAdjustHoursBy.d.ts.map +0 -1
- package/cjs/lib/dateAdjustHoursBy.js +0 -14
- package/cjs/lib/dateAdjustHoursBy.js.map +0 -1
- package/cjs/lib/dateCreateTimeZoneSetter.d.ts +0 -7
- package/cjs/lib/dateCreateTimeZoneSetter.d.ts.map +0 -1
- package/cjs/lib/dateCreateTimeZoneSetter.js +0 -16
- package/cjs/lib/dateCreateTimeZoneSetter.js.map +0 -1
- package/cjs/lib/dateDaysAgo.d.ts +0 -6
- package/cjs/lib/dateDaysAgo.d.ts.map +0 -1
- package/cjs/lib/dateDaysAgo.js +0 -14
- package/cjs/lib/dateDaysAgo.js.map +0 -1
- package/cjs/lib/dateWeekDayName.d.ts +0 -12
- package/cjs/lib/dateWeekDayName.d.ts.map +0 -1
- package/cjs/lib/dateWeekDayName.js +0 -19
- package/cjs/lib/dateWeekDayName.js.map +0 -1
- package/cjs/lib/daysSinceDate.d.ts +0 -13
- package/cjs/lib/daysSinceDate.d.ts.map +0 -1
- package/cjs/lib/daysSinceDate.js +0 -21
- package/cjs/lib/daysSinceDate.js.map +0 -1
- package/cjs/lib/getCentury.d.ts +0 -14
- package/cjs/lib/getCentury.d.ts.map +0 -1
- package/cjs/lib/getCentury.js +0 -22
- package/cjs/lib/getCentury.js.map +0 -1
- package/cjs/lib/getCurrentYear.d.ts +0 -33
- package/cjs/lib/getCurrentYear.d.ts.map +0 -1
- package/cjs/lib/getCurrentYear.js +0 -47
- package/cjs/lib/getCurrentYear.js.map +0 -1
- package/cjs/lib/hoursSinceDate.d.ts +0 -13
- package/cjs/lib/hoursSinceDate.d.ts.map +0 -1
- package/cjs/lib/hoursSinceDate.js +0 -21
- package/cjs/lib/hoursSinceDate.js.map +0 -1
- package/cjs/lib/isLeapYear.d.ts +0 -16
- package/cjs/lib/isLeapYear.d.ts.map +0 -1
- package/cjs/lib/isLeapYear.js +0 -24
- package/cjs/lib/isLeapYear.js.map +0 -1
- package/cjs/lib/isValidDate.d.ts +0 -21
- package/cjs/lib/isValidDate.d.ts.map +0 -1
- package/cjs/lib/isValidDate.js +0 -41
- package/cjs/lib/isValidDate.js.map +0 -1
- package/cjs/lib/isValidDateDay.d.ts +0 -17
- package/cjs/lib/isValidDateDay.d.ts.map +0 -1
- package/cjs/lib/isValidDateDay.js +0 -34
- package/cjs/lib/isValidDateDay.js.map +0 -1
- package/cjs/lib/isValidDateMonth.d.ts +0 -13
- package/cjs/lib/isValidDateMonth.d.ts.map +0 -1
- package/cjs/lib/isValidDateMonth.js +0 -19
- package/cjs/lib/isValidDateMonth.js.map +0 -1
- package/cjs/lib/isValidDateYear.d.ts +0 -16
- package/cjs/lib/isValidDateYear.d.ts.map +0 -1
- package/cjs/lib/isValidDateYear.js +0 -22
- package/cjs/lib/isValidDateYear.js.map +0 -1
- package/cjs/lib/isoDateTimestamp.d.ts +0 -16
- package/cjs/lib/isoDateTimestamp.d.ts.map +0 -1
- package/cjs/lib/isoDateTimestamp.js +0 -22
- package/cjs/lib/isoDateTimestamp.js.map +0 -1
- package/cjs/lib/isoDateTimestampForFilename.d.ts +0 -12
- package/cjs/lib/isoDateTimestampForFilename.d.ts.map +0 -1
- package/cjs/lib/isoDateTimestampForFilename.js +0 -21
- package/cjs/lib/isoDateTimestampForFilename.js.map +0 -1
- package/cjs/lib/minutesSinceDate.d.ts +0 -13
- package/cjs/lib/minutesSinceDate.d.ts.map +0 -1
- package/cjs/lib/minutesSinceDate.js +0 -21
- package/cjs/lib/minutesSinceDate.js.map +0 -1
- package/cjs/lib/monthNameDa.d.ts +0 -17
- package/cjs/lib/monthNameDa.d.ts.map +0 -1
- package/cjs/lib/monthNameDa.js +0 -43
- package/cjs/lib/monthNameDa.js.map +0 -1
- package/cjs/lib/monthNameEn.d.ts +0 -17
- package/cjs/lib/monthNameEn.d.ts.map +0 -1
- package/cjs/lib/monthNameEn.js +0 -43
- package/cjs/lib/monthNameEn.js.map +0 -1
- package/cjs/lib/monthsSinceDate.d.ts +0 -13
- package/cjs/lib/monthsSinceDate.d.ts.map +0 -1
- package/cjs/lib/monthsSinceDate.js +0 -21
- package/cjs/lib/monthsSinceDate.js.map +0 -1
- package/cjs/lib/msSinceDate.d.ts +0 -12
- package/cjs/lib/msSinceDate.d.ts.map +0 -1
- package/cjs/lib/msSinceDate.js +0 -24
- package/cjs/lib/msSinceDate.js.map +0 -1
- package/cjs/lib/numDaysInMonth.d.ts +0 -18
- package/cjs/lib/numDaysInMonth.d.ts.map +0 -1
- package/cjs/lib/numDaysInMonth.js +0 -28
- package/cjs/lib/numDaysInMonth.js.map +0 -1
- package/cjs/lib/prettyIsoDateString.d.ts +0 -14
- package/cjs/lib/prettyIsoDateString.d.ts.map +0 -1
- package/cjs/lib/prettyIsoDateString.js +0 -29
- package/cjs/lib/prettyIsoDateString.js.map +0 -1
- package/cjs/lib/secondsSinceDate.d.ts +0 -11
- package/cjs/lib/secondsSinceDate.d.ts.map +0 -1
- package/cjs/lib/secondsSinceDate.js +0 -19
- package/cjs/lib/secondsSinceDate.js.map +0 -1
- package/cjs/lib/weeksSinceDate.d.ts +0 -11
- package/cjs/lib/weeksSinceDate.d.ts.map +0 -1
- package/cjs/lib/weeksSinceDate.js +0 -19
- package/cjs/lib/weeksSinceDate.js.map +0 -1
- package/cjs/lib/yearsSinceDate.d.ts +0 -11
- package/cjs/lib/yearsSinceDate.d.ts.map +0 -1
- package/cjs/lib/yearsSinceDate.js +0 -19
- package/cjs/lib/yearsSinceDate.js.map +0 -1
package/cjs/lib/msSinceDate.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.msSinceDate = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Calculates the number of milliseconds that have passed since the provided date.
|
|
6
|
-
* @param date The date from which to calculate the elapsed time.
|
|
7
|
-
* @throws If the provided date is not a Date object or an integer.
|
|
8
|
-
* @returns The number of milliseconds that have passed since the provided date.
|
|
9
|
-
* @example ```ts
|
|
10
|
-
* msSinceDate(new Date('2020-01-01'));;
|
|
11
|
-
* //=> {number of milliseconds since 2020-01-01}
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
function msSinceDate(date) {
|
|
15
|
-
if (typeof date === 'number') {
|
|
16
|
-
if (!Number.isInteger(date)) {
|
|
17
|
-
throw new Error('Expected date to be a Date or an integer. Got: ' + date);
|
|
18
|
-
}
|
|
19
|
-
date = new Date(date);
|
|
20
|
-
}
|
|
21
|
-
return Date.now() - date.getTime();
|
|
22
|
-
}
|
|
23
|
-
exports.msSinceDate = msSinceDate;
|
|
24
|
-
//# sourceMappingURL=msSinceDate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msSinceDate.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/msSinceDate.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,SAAgB,WAAW,CAAC,IAAmB;IAC7C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,iDAAiD,GAAG,IAAI,CAAC,CAAA;SAC1E;QACD,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;KACtB;IACD,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;AACpC,CAAC;AARD,kCAQC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get number of days that there are in a given month of a given year.
|
|
3
|
-
* Note: The number of days in february depends on whether it is leap year. If no year is given, it is assumed that it is not leap year.
|
|
4
|
-
* @param month The month for which the number of days is to be calculated. Should be a number between 1 and 12.
|
|
5
|
-
* @param year The year for which the number of days in the month is to be calculated. Optional.
|
|
6
|
-
* @returns The number of days in the given month for the specified year.
|
|
7
|
-
* @throws Will throw an error if the month is not a valid number between 1 and 12.
|
|
8
|
-
* @example ```ts
|
|
9
|
-
* numDaysInMonth(2, 2020);;
|
|
10
|
-
* //=> 29
|
|
11
|
-
* numDaysInMonth(2);;
|
|
12
|
-
* //=> 28
|
|
13
|
-
* numDaysInMonth(1);;
|
|
14
|
-
* //=> 31
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare function numDaysInMonth(month: number, year?: number): number;
|
|
18
|
-
//# sourceMappingURL=numDaysInMonth.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"numDaysInMonth.d.ts","sourceRoot":"","sources":["../../../../../packages/date/src/lib/numDaysInMonth.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAGnE"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.numDaysInMonth = void 0;
|
|
4
|
-
const assertValidDateMonth_1 = require("./assertValidDateMonth");
|
|
5
|
-
const DAYS_IN_MONTH_1 = require("./constants/DAYS_IN_MONTH");
|
|
6
|
-
const isLeapYear_1 = require("./isLeapYear");
|
|
7
|
-
/**
|
|
8
|
-
* Get number of days that there are in a given month of a given year.
|
|
9
|
-
* Note: The number of days in february depends on whether it is leap year. If no year is given, it is assumed that it is not leap year.
|
|
10
|
-
* @param month The month for which the number of days is to be calculated. Should be a number between 1 and 12.
|
|
11
|
-
* @param year The year for which the number of days in the month is to be calculated. Optional.
|
|
12
|
-
* @returns The number of days in the given month for the specified year.
|
|
13
|
-
* @throws Will throw an error if the month is not a valid number between 1 and 12.
|
|
14
|
-
* @example ```ts
|
|
15
|
-
* numDaysInMonth(2, 2020);;
|
|
16
|
-
* //=> 29
|
|
17
|
-
* numDaysInMonth(2);;
|
|
18
|
-
* //=> 28
|
|
19
|
-
* numDaysInMonth(1);;
|
|
20
|
-
* //=> 31
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
function numDaysInMonth(month, year) {
|
|
24
|
-
(0, assertValidDateMonth_1.assertValidDateMonth)(month);
|
|
25
|
-
return month === 2 && year !== undefined && (0, isLeapYear_1.isLeapYear)(year) ? 29 : DAYS_IN_MONTH_1.DAYS_IN_MONTH[month];
|
|
26
|
-
}
|
|
27
|
-
exports.numDaysInMonth = numDaysInMonth;
|
|
28
|
-
//# sourceMappingURL=numDaysInMonth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"numDaysInMonth.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/numDaysInMonth.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,6DAAyD;AACzD,6CAAyC;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,cAAc,CAAC,KAAa,EAAE,IAAa;IACzD,IAAA,2CAAoB,EAAC,KAAK,CAAC,CAAA;IAC3B,OAAO,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAA,uBAAU,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,6BAAa,CAAC,KAAK,CAAC,CAAA;AAC1F,CAAC;AAHD,wCAGC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts an ISO date string into a more readable format.
|
|
3
|
-
*
|
|
4
|
-
* @param iso - The ISO date string to be converted. Defaults to the current date and time.
|
|
5
|
-
* @param dateTimeSeparator - The character to use as a separator between the date and time. Defaults to '_'.
|
|
6
|
-
* @param precision - The level of precision for the date and time. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'. Defaults to 'millisecond'.
|
|
7
|
-
* @returns The converted date string.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* prettyIsoDateString('2020-02-03T14:01:04.437Z', '_', 'minute');
|
|
11
|
-
* //=> 2020.02.03_14.01
|
|
12
|
-
*/
|
|
13
|
-
export declare function prettyIsoDateString(iso?: string, dateTimeSeparator?: string, precision?: 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'): string;
|
|
14
|
-
//# sourceMappingURL=prettyIsoDateString.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prettyIsoDateString.d.ts","sourceRoot":"","sources":["../../../../../packages/date/src/lib/prettyIsoDateString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,GAAE,MAAiC,EACtC,iBAAiB,SAAM,EACvB,SAAS,GAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAA6B,UAGnG"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prettyIsoDateString = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Converts an ISO date string into a more readable format.
|
|
6
|
-
*
|
|
7
|
-
* @param iso - The ISO date string to be converted. Defaults to the current date and time.
|
|
8
|
-
* @param dateTimeSeparator - The character to use as a separator between the date and time. Defaults to '_'.
|
|
9
|
-
* @param precision - The level of precision for the date and time. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'. Defaults to 'millisecond'.
|
|
10
|
-
* @returns The converted date string.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* prettyIsoDateString('2020-02-03T14:01:04.437Z', '_', 'minute');
|
|
14
|
-
* //=> 2020.02.03_14.01
|
|
15
|
-
*/
|
|
16
|
-
function prettyIsoDateString(iso = new Date().toISOString(), dateTimeSeparator = '_', precision = 'millisecond') {
|
|
17
|
-
return iso.substring(0, map[precision]).replace(/T/, dateTimeSeparator).replace(/-|:/g, '.');
|
|
18
|
-
}
|
|
19
|
-
exports.prettyIsoDateString = prettyIsoDateString;
|
|
20
|
-
const map = {
|
|
21
|
-
year: 4,
|
|
22
|
-
month: 7,
|
|
23
|
-
day: 10,
|
|
24
|
-
hour: 13,
|
|
25
|
-
minute: 16,
|
|
26
|
-
second: 19,
|
|
27
|
-
millisecond: 23,
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=prettyIsoDateString.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prettyIsoDateString.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/prettyIsoDateString.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACH,SAAgB,mBAAmB,CACjC,MAAc,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EACtC,iBAAiB,GAAG,GAAG,EACvB,YAAqF,aAAa;IAElG,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAC9F,CAAC;AAND,kDAMC;AAED,MAAM,GAAG,GAAG;IACV,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,EAAE;IACP,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,EAAE;CAChB,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the number of seconds that have passed since the given date.
|
|
3
|
-
* @param date The date from which to calculate the number of seconds.
|
|
4
|
-
* @returns The number of seconds since the given date.
|
|
5
|
-
* @example ```ts
|
|
6
|
-
* secondsSinceDate(new Date('2020-01-01'));;
|
|
7
|
-
* //=> {number of seconds since 2020-01-01}
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare function secondsSinceDate(date: Date | number): number;
|
|
11
|
-
//# sourceMappingURL=secondsSinceDate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secondsSinceDate.d.ts","sourceRoot":"","sources":["../../../../../packages/date/src/lib/secondsSinceDate.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAE5D"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.secondsSinceDate = void 0;
|
|
4
|
-
const MS_IN_SECOND_1 = require("./constants/MS_IN_SECOND");
|
|
5
|
-
const msSinceDate_1 = require("./msSinceDate");
|
|
6
|
-
/**
|
|
7
|
-
* Returns the number of seconds that have passed since the given date.
|
|
8
|
-
* @param date The date from which to calculate the number of seconds.
|
|
9
|
-
* @returns The number of seconds since the given date.
|
|
10
|
-
* @example ```ts
|
|
11
|
-
* secondsSinceDate(new Date('2020-01-01'));;
|
|
12
|
-
* //=> {number of seconds since 2020-01-01}
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
function secondsSinceDate(date) {
|
|
16
|
-
return (0, msSinceDate_1.msSinceDate)(date) / MS_IN_SECOND_1.MS_IN_SECOND;
|
|
17
|
-
}
|
|
18
|
-
exports.secondsSinceDate = secondsSinceDate;
|
|
19
|
-
//# sourceMappingURL=secondsSinceDate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secondsSinceDate.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/secondsSinceDate.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AACvD,+CAA2C;AAE3C;;;;;;;;GAQG;AACH,SAAgB,gBAAgB,CAAC,IAAmB;IAClD,OAAO,IAAA,yBAAW,EAAC,IAAI,CAAC,GAAG,2BAAY,CAAA;AACzC,CAAC;AAFD,4CAEC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the number of weeks that have passed since the provided date.
|
|
3
|
-
* @param date The date from which to calculate the number of weeks passed.
|
|
4
|
-
* @returns The number of weeks since the provided date.
|
|
5
|
-
* @example ```ts
|
|
6
|
-
* weeksSinceDate(new Date('2020-01-01'));;
|
|
7
|
-
* //=> {number of weeks since '2020-01-01'}
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare function weeksSinceDate(date: Date | number): number;
|
|
11
|
-
//# sourceMappingURL=weeksSinceDate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"weeksSinceDate.d.ts","sourceRoot":"","sources":["../../../../../packages/date/src/lib/weeksSinceDate.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAE1D"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.weeksSinceDate = void 0;
|
|
4
|
-
const MS_IN_WEEK_1 = require("./constants/MS_IN_WEEK");
|
|
5
|
-
const msSinceDate_1 = require("./msSinceDate");
|
|
6
|
-
/**
|
|
7
|
-
* Calculates the number of weeks that have passed since the provided date.
|
|
8
|
-
* @param date The date from which to calculate the number of weeks passed.
|
|
9
|
-
* @returns The number of weeks since the provided date.
|
|
10
|
-
* @example ```ts
|
|
11
|
-
* weeksSinceDate(new Date('2020-01-01'));;
|
|
12
|
-
* //=> {number of weeks since '2020-01-01'}
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
function weeksSinceDate(date) {
|
|
16
|
-
return (0, msSinceDate_1.msSinceDate)(date) / MS_IN_WEEK_1.MS_IN_WEEK;
|
|
17
|
-
}
|
|
18
|
-
exports.weeksSinceDate = weeksSinceDate;
|
|
19
|
-
//# sourceMappingURL=weeksSinceDate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"weeksSinceDate.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/weeksSinceDate.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,+CAA2C;AAE3C;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAAC,IAAmB;IAChD,OAAO,IAAA,yBAAW,EAAC,IAAI,CAAC,GAAG,uBAAU,CAAA;AACvC,CAAC;AAFD,wCAEC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the number of years that have passed since the provided date.
|
|
3
|
-
* @param date The date from which to calculate the number of years passed.
|
|
4
|
-
* @returns The number of years that have passed since the provided date.
|
|
5
|
-
* @example ```ts
|
|
6
|
-
* yearsSinceDate(new Date('2000-01-01'));;
|
|
7
|
-
* //=> {number of years since '2000-01-01'}
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare function yearsSinceDate(date: Date | number): number;
|
|
11
|
-
//# sourceMappingURL=yearsSinceDate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"yearsSinceDate.d.ts","sourceRoot":"","sources":["../../../../../packages/date/src/lib/yearsSinceDate.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAE1D"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.yearsSinceDate = void 0;
|
|
4
|
-
const MS_IN_YEAR_1 = require("./constants/MS_IN_YEAR");
|
|
5
|
-
const msSinceDate_1 = require("./msSinceDate");
|
|
6
|
-
/**
|
|
7
|
-
* Calculates the number of years that have passed since the provided date.
|
|
8
|
-
* @param date The date from which to calculate the number of years passed.
|
|
9
|
-
* @returns The number of years that have passed since the provided date.
|
|
10
|
-
* @example ```ts
|
|
11
|
-
* yearsSinceDate(new Date('2000-01-01'));;
|
|
12
|
-
* //=> {number of years since '2000-01-01'}
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
function yearsSinceDate(date) {
|
|
16
|
-
return (0, msSinceDate_1.msSinceDate)(date) / MS_IN_YEAR_1.MS_IN_YEAR;
|
|
17
|
-
}
|
|
18
|
-
exports.yearsSinceDate = yearsSinceDate;
|
|
19
|
-
//# sourceMappingURL=yearsSinceDate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"yearsSinceDate.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/yearsSinceDate.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,+CAA2C;AAE3C;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAAC,IAAmB;IAChD,OAAO,IAAA,yBAAW,EAAC,IAAI,CAAC,GAAG,uBAAU,CAAA;AACvC,CAAC;AAFD,wCAEC"}
|