turf-common 1.2.1-beta.49 → 1.2.1-beta.50
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.
|
@@ -4,7 +4,7 @@ export declare class DateUtilService {
|
|
|
4
4
|
getNDaysCode(n: number): string;
|
|
5
5
|
getDateCode(date: Date): string;
|
|
6
6
|
addNDaysToDate(date: Date, n: number): Date;
|
|
7
|
-
convertStringToDate(dateString: string, format: string): Date;
|
|
7
|
+
convertStringToDate(dateString: string, format: string, timeZone?: string): Date;
|
|
8
8
|
isInPast(date: Date): boolean;
|
|
9
9
|
getDateFromDatabaseDate: (date: string) => Date;
|
|
10
10
|
noOfDaysBetweenDates: (date1: Date, date2: Date) => number;
|
package/build/utils/date-util.js
CHANGED
|
@@ -24,8 +24,12 @@ var DateUtilService = /** @class */ (function () {
|
|
|
24
24
|
DateUtilService.prototype.addNDaysToDate = function (date, n) {
|
|
25
25
|
return (0, date_fns_1.add)(date, { days: n });
|
|
26
26
|
};
|
|
27
|
-
DateUtilService.prototype.convertStringToDate = function (dateString, format) {
|
|
28
|
-
|
|
27
|
+
DateUtilService.prototype.convertStringToDate = function (dateString, format, timeZone) {
|
|
28
|
+
var parsedDate = (0, date_fns_1.parse)(dateString, format, new Date());
|
|
29
|
+
if (timeZone) {
|
|
30
|
+
return utcToZonedTime(parsedDate, timeZone);
|
|
31
|
+
}
|
|
32
|
+
return parsedDate;
|
|
29
33
|
};
|
|
30
34
|
DateUtilService.prototype.isInPast = function (date) {
|
|
31
35
|
return date < new Date();
|
|
@@ -110,3 +114,6 @@ var DateUtilService = /** @class */ (function () {
|
|
|
110
114
|
}());
|
|
111
115
|
exports.DateUtilService = DateUtilService;
|
|
112
116
|
exports.dateUtilService = new DateUtilService();
|
|
117
|
+
function utcToZonedTime(parsedDate, timeZone) {
|
|
118
|
+
throw new Error("Function not implemented.");
|
|
119
|
+
}
|