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 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);
@@ -0,0 +1,5 @@
1
+ export interface IConvertToMidNightTime {
2
+ hour: number;
3
+ minute: number;
4
+ second?: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface INgbDateStruct {
2
+ year: number;
3
+ month: number;
4
+ day: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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, timeZone?: string): Date;
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;
@@ -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, timeZone) {
34
+ DateUtilService.prototype.convertStringToDate = function (dateString, format) {
28
35
  var parsedDate = (0, date_fns_1.parse)(dateString, format, new Date());
29
- if (timeZone) {
30
- return utcToZonedTime(parsedDate, timeZone);
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
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.2.1-beta.50",
3
+ "version": "1.2.1-beta.52",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",