turf-common 1.2.1-beta.50 → 1.2.1-beta.52
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/build/@type.d.ts +2 -0
- package/build/@type.js +2 -0
- package/build/interface/convert-to-midnight-time.interface.d.ts +5 -0
- package/build/interface/convert-to-midnight-time.interface.js +2 -0
- package/build/interface/ng-date-structure.interface.d.ts +5 -0
- package/build/interface/ng-date-structure.interface.js +2 -0
- package/build/utils/date-util.d.ts +4 -1
- package/build/utils/date-util.js +16 -8
- package/package.json +1 -1
package/build/@type.d.ts
CHANGED
|
@@ -29,3 +29,5 @@ export * from "./interface/modify-entity.interface";
|
|
|
29
29
|
export * from "./interface/key-value.interface";
|
|
30
30
|
export * from "./interface/ui/upgrade-subscription-data.interface";
|
|
31
31
|
export * from "./interface/ui/booking-data.interface";
|
|
32
|
+
export * from "./interface/ng-date-structure.interface";
|
|
33
|
+
export * from "./interface/convert-to-midnight-time.interface";
|
package/build/@type.js
CHANGED
|
@@ -46,3 +46,5 @@ __exportStar(require("./interface/key-value.interface"), exports);
|
|
|
46
46
|
// changes for the ui
|
|
47
47
|
__exportStar(require("./interface/ui/upgrade-subscription-data.interface"), exports);
|
|
48
48
|
__exportStar(require("./interface/ui/booking-data.interface"), exports);
|
|
49
|
+
__exportStar(require("./interface/ng-date-structure.interface"), exports);
|
|
50
|
+
__exportStar(require("./interface/convert-to-midnight-time.interface"), exports);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { IConvertToMidNightTime, INgbDateStruct } from "../@type";
|
|
1
2
|
export declare class DateUtilService {
|
|
2
3
|
constructor();
|
|
3
4
|
getTodayCode(): string;
|
|
4
5
|
getNDaysCode(n: number): string;
|
|
5
6
|
getDateCode(date: Date): string;
|
|
6
7
|
addNDaysToDate(date: Date, n: number): Date;
|
|
7
|
-
convertStringToDate(dateString: string, format: string
|
|
8
|
+
convertStringToDate(dateString: string, format: string): Date;
|
|
8
9
|
isInPast(date: Date): boolean;
|
|
9
10
|
getDateFromDatabaseDate: (date: string) => Date;
|
|
10
11
|
noOfDaysBetweenDates: (date1: Date, date2: Date) => number;
|
|
@@ -32,5 +33,7 @@ export declare class DateUtilService {
|
|
|
32
33
|
* Each element in the array is a number in the "yyMM" format.
|
|
33
34
|
*/
|
|
34
35
|
getMonthRangeByDateCodes(startDateCode: string, endDateCode: string): number[];
|
|
36
|
+
convertToMidnight(time: IConvertToMidNightTime): IConvertToMidNightTime;
|
|
37
|
+
convertMonthsToNumber: (months: INgbDateStruct) => string;
|
|
35
38
|
}
|
|
36
39
|
export declare const dateUtilService: DateUtilService;
|
package/build/utils/date-util.js
CHANGED
|
@@ -11,6 +11,13 @@ var DateUtilService = /** @class */ (function () {
|
|
|
11
11
|
var dayDifference = Math.ceil((date2.getTime() - date1.getTime()) / oneDay);
|
|
12
12
|
return dayDifference - 1; //minus 1 day
|
|
13
13
|
};
|
|
14
|
+
this.convertMonthsToNumber = function (months) {
|
|
15
|
+
var year = months.year.toString().slice(2, 4);
|
|
16
|
+
var month = months.month.toString().padStart(2, "0");
|
|
17
|
+
var day = months.day.toString().padStart(2, "0");
|
|
18
|
+
var dates = year.concat(month).concat(day);
|
|
19
|
+
return "".concat(dates);
|
|
20
|
+
};
|
|
14
21
|
}
|
|
15
22
|
DateUtilService.prototype.getTodayCode = function () {
|
|
16
23
|
return (0, date_fns_1.format)(new Date(), "yyMMdd");
|
|
@@ -24,12 +31,11 @@ var DateUtilService = /** @class */ (function () {
|
|
|
24
31
|
DateUtilService.prototype.addNDaysToDate = function (date, n) {
|
|
25
32
|
return (0, date_fns_1.add)(date, { days: n });
|
|
26
33
|
};
|
|
27
|
-
DateUtilService.prototype.convertStringToDate = function (dateString, format
|
|
34
|
+
DateUtilService.prototype.convertStringToDate = function (dateString, format) {
|
|
28
35
|
var parsedDate = (0, date_fns_1.parse)(dateString, format, new Date());
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return parsedDate;
|
|
36
|
+
// IST has a fixed offset of UTC+5:30
|
|
37
|
+
var indianDate = new Date(parsedDate.getTime() + 330 * 60 * 1000);
|
|
38
|
+
return indianDate;
|
|
33
39
|
};
|
|
34
40
|
DateUtilService.prototype.isInPast = function (date) {
|
|
35
41
|
return date < new Date();
|
|
@@ -110,10 +116,12 @@ var DateUtilService = /** @class */ (function () {
|
|
|
110
116
|
var endDate = exports.dateUtilService.convertStringToDate(endDateCode, "yyMMdd");
|
|
111
117
|
return _model_1.BookingCode.getMonthCodesRange(startDate, endDate);
|
|
112
118
|
};
|
|
119
|
+
DateUtilService.prototype.convertToMidnight = function (time) {
|
|
120
|
+
if (time.hour === 0 && time.minute === 0)
|
|
121
|
+
return { hour: 24, minute: 0 };
|
|
122
|
+
return time;
|
|
123
|
+
};
|
|
113
124
|
return DateUtilService;
|
|
114
125
|
}());
|
|
115
126
|
exports.DateUtilService = DateUtilService;
|
|
116
127
|
exports.dateUtilService = new DateUtilService();
|
|
117
|
-
function utcToZonedTime(parsedDate, timeZone) {
|
|
118
|
-
throw new Error("Function not implemented.");
|
|
119
|
-
}
|