@hapiboo/date 2.0.0 → 2.0.2
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/dist/service.d.ts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -0
- package/package.dev.json +1 -1
- package/package.json +1 -1
- package/package.public.json +1 -1
- package/src/service.ts +1 -1
- package/src/utils.ts +5 -1
package/dist/service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DateObject } from './class';
|
|
2
2
|
export declare namespace dateService {
|
|
3
3
|
function initialize(defaultZoneName: string, defaultLocaleName: string): void;
|
|
4
|
-
function parseUtcDate(datetime: string): DateObject | undefined;
|
|
4
|
+
function parseUtcDate(datetime: string | undefined): DateObject | undefined;
|
|
5
5
|
function date(year: number, month: number, day: number): DateObject;
|
|
6
6
|
function datetime(year: number, month: number, day: number, hour: number, minute: number): DateObject;
|
|
7
7
|
function daytime(day: DateObject, hour?: number, minute?: number): DateObject;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateObject } from './class';
|
|
2
2
|
export declare namespace dateUtils {
|
|
3
|
-
function checkPeriod(value: DateObject, start
|
|
3
|
+
function checkPeriod(value: DateObject, start?: DateObject, stop?: DateObject): boolean;
|
|
4
4
|
function checkDatePeriod(value: DateObject, start: DateObject, stop: DateObject): boolean;
|
|
5
5
|
function checkSameYearPeriod(value: DateObject, start: DateObject, stop: DateObject): boolean;
|
|
6
6
|
function checkSameDayPeriod(value: DateObject, start: DateObject, stop: DateObject): boolean;
|
package/dist/utils.js
CHANGED
|
@@ -5,6 +5,9 @@ const service_1 = require("./service");
|
|
|
5
5
|
var dateUtils;
|
|
6
6
|
(function (dateUtils) {
|
|
7
7
|
function checkPeriod(value, start, stop) {
|
|
8
|
+
if (!start) {
|
|
9
|
+
start = service_1.dateService.date(0, 1, 1);
|
|
10
|
+
}
|
|
8
11
|
if (!stop) {
|
|
9
12
|
stop = service_1.dateService.date(3000, 12, 31);
|
|
10
13
|
}
|
package/package.dev.json
CHANGED
package/package.json
CHANGED
package/package.public.json
CHANGED
package/src/service.ts
CHANGED
|
@@ -10,7 +10,7 @@ export namespace dateService {
|
|
|
10
10
|
Settings.defaultLocale = defaultLocaleName;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function parseUtcDate(datetime: string) : DateObject | undefined {
|
|
13
|
+
export function parseUtcDate(datetime: string | undefined) : DateObject | undefined {
|
|
14
14
|
if (datetime) {
|
|
15
15
|
const temp = DateTime.fromISO(datetime);
|
|
16
16
|
if (temp) {
|
package/src/utils.ts
CHANGED
|
@@ -3,7 +3,11 @@ import { DateObject } from './class';
|
|
|
3
3
|
|
|
4
4
|
export namespace dateUtils {
|
|
5
5
|
|
|
6
|
-
export function checkPeriod(value: DateObject, start
|
|
6
|
+
export function checkPeriod(value: DateObject, start?: DateObject, stop?: DateObject): boolean {
|
|
7
|
+
if (!start) {
|
|
8
|
+
start = dateService.date(0, 1, 1);
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
if (!stop) {
|
|
8
12
|
stop = dateService.date(3000, 12, 31);
|
|
9
13
|
}
|