@pegasimed.com/shared-tools 1.0.70 → 1.0.71

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.
@@ -1,2 +1,7 @@
1
1
  export declare const convertMinutesToTimeAmPm: (minutes: number) => string;
2
2
  export declare const convertMinutesToTime24: (minutes: number) => string;
3
+ export declare const getDateWithMonthRange: () => {
4
+ currentDate: Date;
5
+ previousMonth: Date;
6
+ nextMonth: Date;
7
+ };
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.convertMinutesToTime24 = exports.convertMinutesToTimeAmPm = void 0;
6
+ exports.getDateWithMonthRange = exports.convertMinutesToTime24 = exports.convertMinutesToTimeAmPm = void 0;
7
7
  const moment_1 = __importDefault(require("moment"));
8
8
  const convertMinutesToTimeAmPm = (minutes) => {
9
9
  return (0, moment_1.default)().startOf('day').add(minutes, 'minutes').format('hh:mm A');
@@ -13,4 +13,13 @@ const convertMinutesToTime24 = (minutes) => {
13
13
  return (0, moment_1.default)().startOf('day').add(minutes, 'minutes').format('HH:mm');
14
14
  };
15
15
  exports.convertMinutesToTime24 = convertMinutesToTime24;
16
+ const getDateWithMonthRange = () => {
17
+ const now = new Date();
18
+ return {
19
+ currentDate: now,
20
+ previousMonth: (0, moment_1.default)(now).subtract(1, 'month').toDate(),
21
+ nextMonth: (0, moment_1.default)(now).add(1, 'month').toDate(),
22
+ };
23
+ };
24
+ exports.getDateWithMonthRange = getDateWithMonthRange;
16
25
  //# sourceMappingURL=date.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAErB,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE;IAClE,OAAO,IAAA,gBAAM,GAAE,CAAC,OA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AC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE;KAChD,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,qBAAqB,yBAWhC"}
@@ -0,0 +1 @@
1
+ export declare const getAge: (birthDate: any) => number | null;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAge = void 0;
4
+ const getAge = (birthDate) => {
5
+ if (!birthDate || !Date.parse(birthDate)) {
6
+ return null;
7
+ }
8
+ const birth = new Date(birthDate);
9
+ const today = new Date();
10
+ let age = today.getFullYear() - birth.getFullYear();
11
+ const monthDiff = today.getMonth() - birth.getMonth();
12
+ // Adjust age if the birthday hasn't occurred yet this year
13
+ if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
14
+ age--;
15
+ }
16
+ return age;
17
+ };
18
+ exports.getAge = getAge;
19
+ //# sourceMappingURL=getAge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAge.js","sourceRoot":"","sources":["../../../../src/utils/documents/core/getAge.ts"],"names":[],"mappings":";;;AAAO,MAAM,MAAM,GAAG,CAAC,SAAc,EAAiB,EAAE;IACtD,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IAEzB,IAAI,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IACpD,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAEtD,2DAA2D;IAC3D,IAAI,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QAC5E,GAAG,EAAE,CAAC;IACR,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAjBW,QAAA,MAAM,UAiBjB"}
@@ -1,4 +1,5 @@
1
1
  export * from './emailValidate';
2
+ export * from './getAge';
2
3
  export * from './getBirthCountry';
3
4
  export * from './getBodySite';
4
5
  export * from './getCodeableConceptTranslate';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./emailValidate"), exports);
18
+ __exportStar(require("./getAge"), exports);
18
19
  __exportStar(require("./getBirthCountry"), exports);
19
20
  __exportStar(require("./getBodySite"), exports);
20
21
  __exportStar(require("./getCodeableConceptTranslate"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/documents/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,oDAAkC;AAClC,gDAA8B;AAC9B,gEAA8C;AAC9C,gDAA8B;AAC9B,yDAAuC;AACvC,mDAAiC;AACjC,0DAAwC;AACxC,uDAAqC;AACrC,gEAA8C;AAC9C,kDAAgC;AAChC,sDAAoC;AACpC,6CAA2B;AAC3B,gDAA8B;AAC9B,oDAAkC;AAClC,oDAAkC;AAClC,kDAAgC;AAChC,sDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/documents/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,2CAAyB;AACzB,oDAAkC;AAClC,gDAA8B;AAC9B,gEAA8C;AAC9C,gDAA8B;AAC9B,yDAAuC;AACvC,mDAAiC;AACjC,0DAAwC;AACxC,uDAAqC;AACrC,gEAA8C;AAC9C,kDAAgC;AAChC,sDAAoC;AACpC,6CAA2B;AAC3B,gDAA8B;AAC9B,oDAAkC;AAClC,oDAAkC;AAClC,kDAAgC;AAChC,sDAAoC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pegasimed.com/shared-tools",
3
- "version": "1.0.70",
3
+ "version": "1.0.71",
4
4
  "description": "Pegasi shared tools",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",