turf-common 1.1.1-beta.22 → 1.1.1-beta.23
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 +20 -20
- package/build/interface/date-formatter.interface.d.ts +4 -0
- package/build/interface/date-formatter.interface.js +2 -0
- package/build/interface/formate-date-and-time.interface.d.ts +6 -0
- package/build/interface/formate-date-and-time.interface.js +2 -0
- package/build/interface/time-formatter.interface.d.ts +4 -0
- package/build/interface/time-formatter.interface.js +2 -0
- package/build/models/booking-code-model.d.ts +21 -5
- package/build/models/booking-code-model.js +113 -19
- package/build/models/time-slot-model.d.ts +1 -0
- package/build/models/time-slot-model.js +3 -0
- package/build/utils/date-util.d.ts +15 -0
- package/build/utils/date-util.js +63 -0
- package/package.json +38 -35
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
## 1 npm init -y
|
|
2
|
-
|
|
3
|
-
## 2 npm login
|
|
4
|
-
|
|
5
|
-
## 3 npm version patch
|
|
6
|
-
|
|
7
|
-
# //it increase version
|
|
8
|
-
|
|
9
|
-
## 3 npm publish --access public
|
|
10
|
-
|
|
11
|
-
# //npm publish by default --access public
|
|
12
|
-
|
|
13
|
-
## 4 npm run version:deploy
|
|
14
|
-
|
|
15
|
-
### deploy version
|
|
16
|
-
|
|
17
|
-
## Client side
|
|
18
|
-
|
|
19
|
-
update package command <br />
|
|
20
|
-
npm update turf-comman
|
|
1
|
+
## 1 npm init -y
|
|
2
|
+
|
|
3
|
+
## 2 npm login
|
|
4
|
+
|
|
5
|
+
## 3 npm version patch
|
|
6
|
+
|
|
7
|
+
# //it increase version
|
|
8
|
+
|
|
9
|
+
## 3 npm publish --access public
|
|
10
|
+
|
|
11
|
+
# //npm publish by default --access public
|
|
12
|
+
|
|
13
|
+
## 4 npm run version:deploy
|
|
14
|
+
|
|
15
|
+
### deploy version
|
|
16
|
+
|
|
17
|
+
## Client side
|
|
18
|
+
|
|
19
|
+
update package command <br />
|
|
20
|
+
npm update turf-comman
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { TimeSlot } from "./time-slot-model";
|
|
2
2
|
import { IGetBookingCodesPerThirtyMinutes } from "../interface/get-booking-codes-per-thirty-min.interface";
|
|
3
|
+
import { IFormateDateAndTime } from "../interface/formate-date-and-time.interface";
|
|
4
|
+
import { IDateFormatter } from "../interface/date-formatter.interface";
|
|
5
|
+
import { ITimeFormatter } from "../interface/time-formatter.interface";
|
|
3
6
|
export declare class BookingCode {
|
|
4
7
|
code: string;
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
turfId: string;
|
|
9
|
+
pitchNumber: string;
|
|
7
10
|
slot: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
fromTimeCode: string;
|
|
12
|
+
toTimeCode: string;
|
|
13
|
+
dateCode: string;
|
|
11
14
|
cost: string;
|
|
12
15
|
constructor(code: string, cost?: string);
|
|
13
16
|
parse(): BookingCode;
|
|
@@ -69,4 +72,17 @@ export declare class BookingCode {
|
|
|
69
72
|
getCost(): number;
|
|
70
73
|
getTimeslot(): TimeSlot;
|
|
71
74
|
static getIndianTimeZoneDate(bookingBufferOffsetHour?: number): Date;
|
|
75
|
+
getInstanceByPitchNo(newPitchNo: number): BookingCode;
|
|
76
|
+
getDateFromTimeCode(): number;
|
|
77
|
+
getPreviousBookingSlotCode(): string;
|
|
78
|
+
getPreviousBookingCode(): BookingCode;
|
|
79
|
+
getPreviousTimeSlotCode(isHour?: boolean): string;
|
|
80
|
+
getNextBookingSlotCode(): string;
|
|
81
|
+
getNextTimeSlotCode(isHour?: boolean): string;
|
|
82
|
+
getNextBookingCode(): BookingCode;
|
|
83
|
+
getOffsetTimeSlotCode(timeCode: string, isHour?: boolean, isNext?: boolean): string;
|
|
84
|
+
isInPast(): boolean;
|
|
85
|
+
formatDateAndTime(formateDateAndTime: IFormateDateAndTime): string;
|
|
86
|
+
static timeFormatter(timeFormatter: ITimeFormatter): string;
|
|
87
|
+
static dateFormatter(dateFormatter: IDateFormatter): string;
|
|
72
88
|
}
|
|
@@ -15,6 +15,8 @@ exports.BookingCode = void 0;
|
|
|
15
15
|
var time_slot_model_1 = require("./time-slot-model");
|
|
16
16
|
var charge_model_1 = require("./charge-model");
|
|
17
17
|
var app_badrequest_exception_1 = require("../exceptions/app-badrequest.exception");
|
|
18
|
+
var date_util_1 = require("../utils/date-util");
|
|
19
|
+
var date_fns_1 = require("date-fns");
|
|
18
20
|
var BookingCode = /** @class */ (function () {
|
|
19
21
|
function BookingCode(code, cost) {
|
|
20
22
|
if (cost === void 0) { cost = "-1"; }
|
|
@@ -32,27 +34,27 @@ var BookingCode = /** @class */ (function () {
|
|
|
32
34
|
if (!matches) {
|
|
33
35
|
throw new Error("Booking slot ".concat(this.code, " is invalid"));
|
|
34
36
|
}
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
+
this.turfId = matches[1];
|
|
38
|
+
this.dateCode = matches[2];
|
|
37
39
|
this.slot = matches[3];
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
40
|
+
this.fromTimeCode = matches[3].slice(0, 4);
|
|
41
|
+
this.toTimeCode = matches[3].slice(4, 8);
|
|
42
|
+
this.pitchNumber = matches[4];
|
|
41
43
|
return this;
|
|
42
44
|
};
|
|
43
45
|
BookingCode.prototype.getBookingTimeInMinutes = function () {
|
|
44
46
|
//from HHMM to HHMM
|
|
45
|
-
var fromHours = parseInt(this.
|
|
46
|
-
var fromMinutes = parseInt(this.
|
|
47
|
-
var toHours = parseInt(this.
|
|
48
|
-
var toMinutes = parseInt(this.
|
|
47
|
+
var fromHours = parseInt(this.fromTimeCode.slice(0, 2));
|
|
48
|
+
var fromMinutes = parseInt(this.fromTimeCode.slice(2, 4));
|
|
49
|
+
var toHours = parseInt(this.toTimeCode.slice(0, 2));
|
|
50
|
+
var toMinutes = parseInt(this.toTimeCode.slice(2, 4));
|
|
49
51
|
return toHours * 60 + toMinutes - (fromHours * 60 + fromMinutes);
|
|
50
52
|
};
|
|
51
53
|
BookingCode.prototype.getPitchNo = function () {
|
|
52
|
-
return parseInt(this.
|
|
54
|
+
return parseInt(this.pitchNumber);
|
|
53
55
|
};
|
|
54
56
|
BookingCode.prototype.getHalfHourTimeCodes = function () {
|
|
55
|
-
return new time_slot_model_1.TimeSlot(this.
|
|
57
|
+
return new time_slot_model_1.TimeSlot(this.fromTimeCode, this.toTimeCode).getHalfHourTimeCodes();
|
|
56
58
|
};
|
|
57
59
|
/**
|
|
58
60
|
*
|
|
@@ -76,7 +78,7 @@ var BookingCode = /** @class */ (function () {
|
|
|
76
78
|
var intBits = stringBits.map(function (bit) { return parseInt(bit); });
|
|
77
79
|
return new Date(intBits[0], intBits[1] - 1, intBits[2]);
|
|
78
80
|
}
|
|
79
|
-
return getDate("20".concat(this.
|
|
81
|
+
return getDate("20".concat(this.dateCode.slice(0, 2), ".").concat(this.dateCode.slice(2, 4), ".").concat(this.dateCode.slice(4, 6)));
|
|
80
82
|
};
|
|
81
83
|
BookingCode.prototype.getDateCode = function () {
|
|
82
84
|
var date = this.getValidDate();
|
|
@@ -85,21 +87,21 @@ var BookingCode = /** @class */ (function () {
|
|
|
85
87
|
.padStart(2, "0")).concat(date.getDate().toString().padStart(2, "0"));
|
|
86
88
|
};
|
|
87
89
|
BookingCode.prototype.getWeekday = function () {
|
|
88
|
-
var dateObj = new Date(2000 + parseInt(this.
|
|
89
|
-
parseInt(this.
|
|
90
|
-
parseInt(this.
|
|
90
|
+
var dateObj = new Date(2000 + parseInt(this.dateCode.slice(0, 2)), // Year
|
|
91
|
+
parseInt(this.dateCode.toString().slice(2, 4)) - 1, // Month (0-indexed)
|
|
92
|
+
parseInt(this.dateCode.toString().slice(4, 6)) // Day
|
|
91
93
|
);
|
|
92
94
|
return dateObj.getDay() === 0 ? 7 : dateObj.getDay();
|
|
93
95
|
// return weekday;
|
|
94
96
|
};
|
|
95
97
|
BookingCode.prototype.getMonthCode = function () {
|
|
96
|
-
return this.
|
|
98
|
+
return this.dateCode.slice(0, 4);
|
|
97
99
|
};
|
|
98
100
|
BookingCode.prototype.getDateWithFromTimeCode = function () {
|
|
99
|
-
return "".concat(this.
|
|
101
|
+
return "".concat(this.dateCode).concat(this.fromTimeCode);
|
|
100
102
|
};
|
|
101
103
|
BookingCode.prototype.getCodeWithoutTurfCode = function () {
|
|
102
|
-
return "".concat(this.
|
|
104
|
+
return "".concat(this.dateCode).concat(this.slot).concat(this.pitchNumber);
|
|
103
105
|
};
|
|
104
106
|
BookingCode.sortByCode = function (bookingCodes) {
|
|
105
107
|
bookingCodes.sort(function (_a, _b) {
|
|
@@ -399,7 +401,7 @@ var BookingCode = /** @class */ (function () {
|
|
|
399
401
|
.reduce(function (a, b) { return a + b; }, 0);
|
|
400
402
|
};
|
|
401
403
|
BookingCode.prototype.getTimeslot = function () {
|
|
402
|
-
return new time_slot_model_1.TimeSlot(this.
|
|
404
|
+
return new time_slot_model_1.TimeSlot(this.fromTimeCode, this.toTimeCode);
|
|
403
405
|
};
|
|
404
406
|
BookingCode.getIndianTimeZoneDate = function (bookingBufferOffsetHour) {
|
|
405
407
|
var now = new Date();
|
|
@@ -409,6 +411,98 @@ var BookingCode = /** @class */ (function () {
|
|
|
409
411
|
(bookingBufferOffsetHour || 0) * 60 * 60 * 1000;
|
|
410
412
|
return new Date(indianTimeMillis);
|
|
411
413
|
};
|
|
414
|
+
//--------------------------------------------------------------
|
|
415
|
+
BookingCode.prototype.getInstanceByPitchNo = function (newPitchNo) {
|
|
416
|
+
return new BookingCode("".concat(this.code.slice(0, -2)).concat(newPitchNo.toString().padStart(2, "0")), this.cost);
|
|
417
|
+
};
|
|
418
|
+
BookingCode.prototype.getDateFromTimeCode = function () {
|
|
419
|
+
return parseInt("".concat(this.dateCode).concat(this.fromTimeCode));
|
|
420
|
+
};
|
|
421
|
+
BookingCode.prototype.getPreviousBookingSlotCode = function () {
|
|
422
|
+
var prevousBookingCode = this.getPreviousBookingCode();
|
|
423
|
+
return "".concat(prevousBookingCode.dateCode).concat(prevousBookingCode
|
|
424
|
+
.getTimeslot()
|
|
425
|
+
.getCode());
|
|
426
|
+
};
|
|
427
|
+
BookingCode.prototype.getPreviousBookingCode = function () {
|
|
428
|
+
if (this.fromTimeCode === "0000") {
|
|
429
|
+
// Add previous day
|
|
430
|
+
var previousDateCode = date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, -1);
|
|
431
|
+
// return `${previousDateCode}23302400`;
|
|
432
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(previousDateCode, "23302400").concat(this.code.slice(-2)));
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
var previousTimeSlotCode = this.getPreviousTimeSlotCode();
|
|
436
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(this.dateCode).concat(previousTimeSlotCode).concat(this.fromTimeCode).concat(this.code.slice(-2)));
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
BookingCode.prototype.getPreviousTimeSlotCode = function (isHour) {
|
|
440
|
+
if (isHour === void 0) { isHour = false; }
|
|
441
|
+
return this.getOffsetTimeSlotCode(this.fromTimeCode, isHour, false);
|
|
442
|
+
};
|
|
443
|
+
BookingCode.prototype.getNextBookingSlotCode = function () {
|
|
444
|
+
var nextBookingCode = this.getNextBookingCode();
|
|
445
|
+
return "".concat(nextBookingCode.dateCode).concat(nextBookingCode
|
|
446
|
+
.getTimeslot()
|
|
447
|
+
.getCode());
|
|
448
|
+
};
|
|
449
|
+
BookingCode.prototype.getNextTimeSlotCode = function (isHour) {
|
|
450
|
+
if (isHour === void 0) { isHour = false; }
|
|
451
|
+
return this.getOffsetTimeSlotCode(this.toTimeCode, isHour, true);
|
|
452
|
+
};
|
|
453
|
+
BookingCode.prototype.getNextBookingCode = function () {
|
|
454
|
+
var toTimeSlotCode = this.toTimeCode;
|
|
455
|
+
if (this.toTimeCode === "2400") {
|
|
456
|
+
// Add next day
|
|
457
|
+
var nextDateCode = date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, 1);
|
|
458
|
+
// return `${nextDateCode}00000030`;
|
|
459
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(nextDateCode, "00000030").concat(this.code.slice(-2)));
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
var nextTimeSlotCode = this.getNextTimeSlotCode();
|
|
463
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(this.dateCode).concat(toTimeSlotCode).concat(nextTimeSlotCode).concat(this.code.slice(-2)));
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
BookingCode.prototype.getOffsetTimeSlotCode = function (timeCode, isHour, isNext) {
|
|
467
|
+
if (isHour === void 0) { isHour = false; }
|
|
468
|
+
if (isNext === void 0) { isNext = true; }
|
|
469
|
+
var minutes = parseInt(timeCode.slice(0, 2)) * 60 +
|
|
470
|
+
parseInt(timeCode.slice(2, 4)) +
|
|
471
|
+
(isNext ? 1 : -1) * (isHour ? 60 : 30);
|
|
472
|
+
return "".concat(Math.floor(minutes / 60)
|
|
473
|
+
.toString()
|
|
474
|
+
.padStart(2, "0")).concat((minutes % 60).toString().padStart(2, "0"));
|
|
475
|
+
};
|
|
476
|
+
BookingCode.prototype.isInPast = function () {
|
|
477
|
+
var pastBookingCode = "".concat(this.dateCode).concat(this.getTimeslot().getCode());
|
|
478
|
+
var currentTime = new Date().getTime();
|
|
479
|
+
return (new Date(parseInt("20".concat(pastBookingCode.slice(0, 2))), parseInt(pastBookingCode.slice(2, 4)) - 1, parseInt(pastBookingCode.slice(4, 6)), parseInt(pastBookingCode.slice(6, 8)), parseInt(pastBookingCode.slice(8, 10))).getTime() < currentTime);
|
|
480
|
+
};
|
|
481
|
+
BookingCode.prototype.formatDateAndTime = function (formateDateAndTime) {
|
|
482
|
+
var dateFormat = formateDateAndTime.dateFormat, timeFormat = formateDateAndTime.timeFormat, separator = formateDateAndTime.separator, timeSeparator = formateDateAndTime.timeSeparator;
|
|
483
|
+
var formattedDate = BookingCode.dateFormatter({
|
|
484
|
+
dateFormat: dateFormat,
|
|
485
|
+
dateCode: this.dateCode,
|
|
486
|
+
});
|
|
487
|
+
var formattedFromTime = BookingCode.timeFormatter({
|
|
488
|
+
timeFormat: timeFormat,
|
|
489
|
+
timeCode: this.fromTimeCode,
|
|
490
|
+
});
|
|
491
|
+
var formattedToTime = BookingCode.timeFormatter({
|
|
492
|
+
timeFormat: timeFormat,
|
|
493
|
+
timeCode: this.toTimeCode,
|
|
494
|
+
});
|
|
495
|
+
return "".concat(formattedDate).concat(separator).concat(formattedFromTime).concat(timeSeparator).concat(formattedToTime);
|
|
496
|
+
};
|
|
497
|
+
BookingCode.timeFormatter = function (timeFormatter) {
|
|
498
|
+
var timeCode = timeFormatter.timeCode, timeFormat = timeFormatter.timeFormat;
|
|
499
|
+
var parsedFromTime = (0, date_fns_1.parse)(timeCode, "HHmm", new Date());
|
|
500
|
+
return (0, date_fns_1.format)(parsedFromTime, timeFormat);
|
|
501
|
+
};
|
|
502
|
+
BookingCode.dateFormatter = function (dateFormatter) {
|
|
503
|
+
var dateFormat = dateFormatter.dateFormat, dateCode = dateFormatter.dateCode;
|
|
504
|
+
return (0, date_fns_1.format)(BookingCode.convertToDate(dateCode), dateFormat);
|
|
505
|
+
};
|
|
412
506
|
return BookingCode;
|
|
413
507
|
}());
|
|
414
508
|
exports.BookingCode = BookingCode;
|
|
@@ -3,6 +3,7 @@ export declare class TimeSlot {
|
|
|
3
3
|
toTime: string;
|
|
4
4
|
constructor(fromTime: string, toTime: string);
|
|
5
5
|
isOverLap(timeSlot: TimeSlot): boolean;
|
|
6
|
+
getCode(): string;
|
|
6
7
|
getOverlapTime(timeSlot: TimeSlot): TimeSlot | null;
|
|
7
8
|
getNonOverlapTimeSlots(existingPriceSlot: TimeSlot): string[];
|
|
8
9
|
getStartMinutes(): number;
|
|
@@ -9,6 +9,9 @@ var TimeSlot = /** @class */ (function () {
|
|
|
9
9
|
TimeSlot.prototype.isOverLap = function (timeSlot) {
|
|
10
10
|
return this.fromTime < timeSlot.toTime && this.toTime > timeSlot.fromTime;
|
|
11
11
|
};
|
|
12
|
+
TimeSlot.prototype.getCode = function () {
|
|
13
|
+
return "".concat(this.fromTime).concat(this.toTime);
|
|
14
|
+
};
|
|
12
15
|
TimeSlot.prototype.getOverlapTime = function (timeSlot) {
|
|
13
16
|
if (!this.isOverLap(timeSlot)) {
|
|
14
17
|
return null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class DateUtilService {
|
|
2
|
+
constructor();
|
|
3
|
+
getTodayCode(): string;
|
|
4
|
+
getNDaysCode(n: number): string;
|
|
5
|
+
getDateCode(date: Date): string;
|
|
6
|
+
addNDaysToDate(date: Date, n: number): Date;
|
|
7
|
+
convertStringToDate(dateString: string, format: string): Date;
|
|
8
|
+
isInPast(date: Date): boolean;
|
|
9
|
+
getDateFromDatabaseDate: (date: string) => Date;
|
|
10
|
+
noOfDaysBetweenDates: (date1: Date, date2: Date) => number;
|
|
11
|
+
addNDaysToDateCode(dateCode: string, n: number): string;
|
|
12
|
+
formatTimeSlotCode(timeSlot: string, both?: boolean, date?: Date | null): string;
|
|
13
|
+
formatDateCode(dateCode: string): string;
|
|
14
|
+
}
|
|
15
|
+
export declare const dateUtilService: DateUtilService;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateUtilService = exports.DateUtilService = void 0;
|
|
4
|
+
var date_fns_1 = require("date-fns");
|
|
5
|
+
var DateUtilService = /** @class */ (function () {
|
|
6
|
+
function DateUtilService() {
|
|
7
|
+
this.getDateFromDatabaseDate = function (date) { return (0, date_fns_1.parseISO)(date); };
|
|
8
|
+
this.noOfDaysBetweenDates = function (date1, date2) {
|
|
9
|
+
var oneDay = 24 * 60 * 60 * 1000;
|
|
10
|
+
var dayDifference = Math.ceil((date2.getTime() - date1.getTime()) / oneDay);
|
|
11
|
+
return dayDifference - 1; //minus 1 day
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
DateUtilService.prototype.getTodayCode = function () {
|
|
15
|
+
return (0, date_fns_1.format)(new Date(), "yyMMdd");
|
|
16
|
+
};
|
|
17
|
+
DateUtilService.prototype.getNDaysCode = function (n) {
|
|
18
|
+
return (0, date_fns_1.format)(this.addNDaysToDate(new Date(), n), "yyMMdd");
|
|
19
|
+
};
|
|
20
|
+
DateUtilService.prototype.getDateCode = function (date) {
|
|
21
|
+
return (0, date_fns_1.format)(date, "yyMMdd");
|
|
22
|
+
};
|
|
23
|
+
DateUtilService.prototype.addNDaysToDate = function (date, n) {
|
|
24
|
+
return (0, date_fns_1.add)(date, { days: n });
|
|
25
|
+
};
|
|
26
|
+
DateUtilService.prototype.convertStringToDate = function (dateString, format) {
|
|
27
|
+
return (0, date_fns_1.parse)(dateString, format, new Date());
|
|
28
|
+
};
|
|
29
|
+
DateUtilService.prototype.isInPast = function (date) {
|
|
30
|
+
return date < new Date();
|
|
31
|
+
};
|
|
32
|
+
DateUtilService.prototype.addNDaysToDateCode = function (dateCode, n) {
|
|
33
|
+
return this.getDateCode(this.addNDaysToDate(this.convertStringToDate(dateCode, "yyMMdd"), n));
|
|
34
|
+
};
|
|
35
|
+
DateUtilService.prototype.formatTimeSlotCode = function (timeSlot, both, date) {
|
|
36
|
+
if (both === void 0) { both = true; }
|
|
37
|
+
if (date === void 0) { date = null; }
|
|
38
|
+
if (!date)
|
|
39
|
+
date = new Date();
|
|
40
|
+
var fromTime = (0, date_fns_1.parse)(timeSlot.slice(0, 4), "HHmm", date);
|
|
41
|
+
if (both) {
|
|
42
|
+
var toTime = void 0;
|
|
43
|
+
if (timeSlot.slice(4) === "2400")
|
|
44
|
+
toTime = (0, date_fns_1.parse)("0000", "HHmm", new Date());
|
|
45
|
+
else
|
|
46
|
+
toTime = (0, date_fns_1.parse)(timeSlot.slice(4), "HHmm", new Date());
|
|
47
|
+
timeSlot =
|
|
48
|
+
timeSlot.slice(0, 4) +
|
|
49
|
+
(timeSlot.slice(4) === "2400" ? "0000" : timeSlot.slice(4));
|
|
50
|
+
return "".concat((0, date_fns_1.format)(fromTime, "hh:mm a"), " - ").concat((0, date_fns_1.format)(toTime, "hh:mm a"));
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
return "".concat((0, date_fns_1.format)(fromTime, "hh:mm a"));
|
|
54
|
+
};
|
|
55
|
+
DateUtilService.prototype.formatDateCode = function (dateCode) {
|
|
56
|
+
var date = (0, date_fns_1.parse)(dateCode, "yyMMdd", new Date());
|
|
57
|
+
var d = (0, date_fns_1.format)(date, "dd-MMM (EE)");
|
|
58
|
+
return d.slice(0, d.length - 2) + d.slice(d.length - 1);
|
|
59
|
+
};
|
|
60
|
+
return DateUtilService;
|
|
61
|
+
}());
|
|
62
|
+
exports.DateUtilService = DateUtilService;
|
|
63
|
+
exports.dateUtilService = new DateUtilService();
|
package/package.json
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "turf-common",
|
|
3
|
-
"version": "1.1.1-beta.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "./build/index.js",
|
|
6
|
-
"types": "./build/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"build/**/*"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"clean": "del build",
|
|
12
|
-
"build": "npm run clean && tsc",
|
|
13
|
-
"version:deploy:patch": "npm version patch && git push && npm run build && npm publish",
|
|
14
|
-
"version:deploy:minor": "npm version minor && git push && npm run build && npm publish",
|
|
15
|
-
"version:deploy:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
|
|
16
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
17
|
-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" 2>&1| tee eslint.log",
|
|
18
|
-
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
|
|
19
|
-
},
|
|
20
|
-
"repository": {
|
|
21
|
-
"type": "git",
|
|
22
|
-
"url": "github__bellex-dev__turf-common:bellex-dev/turf-common.git"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [],
|
|
25
|
-
"author": "",
|
|
26
|
-
"license": "ISC",
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"@types/node": "^20.8.9",
|
|
29
|
-
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
30
|
-
"@typescript-eslint/parser": "^6.7.2",
|
|
31
|
-
"del-cli": "^5.1.0",
|
|
32
|
-
"eslint": "^8.50.0",
|
|
33
|
-
"typescript": "^5.2.2"
|
|
34
|
-
}
|
|
35
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "turf-common",
|
|
3
|
+
"version": "1.1.1-beta.23",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./build/index.js",
|
|
6
|
+
"types": "./build/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"build/**/*"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"clean": "del build",
|
|
12
|
+
"build": "npm run clean && tsc",
|
|
13
|
+
"version:deploy:patch": "npm version patch && git push && npm run build && npm publish",
|
|
14
|
+
"version:deploy:minor": "npm version minor && git push && npm run build && npm publish",
|
|
15
|
+
"version:deploy:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
|
|
16
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
17
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" 2>&1| tee eslint.log",
|
|
18
|
+
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "github__bellex-dev__turf-common:bellex-dev/turf-common.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"author": "",
|
|
26
|
+
"license": "ISC",
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^20.8.9",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
30
|
+
"@typescript-eslint/parser": "^6.7.2",
|
|
31
|
+
"del-cli": "^5.1.0",
|
|
32
|
+
"eslint": "^8.50.0",
|
|
33
|
+
"typescript": "^5.2.2"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"date-fns": "^2.30.0"
|
|
37
|
+
}
|
|
38
|
+
}
|