@ltht-react/utils
Advanced tools
Comparing version 1.1.47 to 1.1.48
@@ -6,2 +6,10 @@ # Change Log | ||
## 1.1.48 (2022-02-07) | ||
**Note:** Version bump only for package @ltht-react/utils | ||
## 1.1.47 (2022-02-02) | ||
@@ -8,0 +16,0 @@ |
import { Patient, NhsNumberStatus } from '@ltht-react/types'; | ||
declare const formatPatientAddress: (patient: Patient | undefined) => string; | ||
declare const formatPatientAge: (patient: Patient | undefined) => string; | ||
declare const formatPatientAge: (patient: Patient | undefined, deceased: boolean) => string; | ||
declare const formatPatientName: (patient: Patient | undefined) => string; | ||
@@ -5,0 +5,0 @@ declare const formatNHSNumber: (patient: Patient | undefined) => string; |
@@ -16,3 +16,3 @@ "use strict"; | ||
exports.formatPatientAddress = formatPatientAddress; | ||
var formatPatientAge = function (patient) { | ||
var formatPatientAge = function (patient, deceased) { | ||
var _a, _b, _c; | ||
@@ -22,4 +22,4 @@ var start = ((_a = patient === null || patient === void 0 ? void 0 : patient.birthDate) === null || _a === void 0 ? void 0 : _a.value) ? new Date(patient.birthDate.value) : null; | ||
// ToDO birth/death date Partial date time check | ||
if ((_b = patient === null || patient === void 0 ? void 0 : patient.deceased) === null || _b === void 0 ? void 0 : _b.deceasedBoolean) { | ||
end = ((_c = patient.deceased.deceasedDateTime) === null || _c === void 0 ? void 0 : _c.value) ? new Date(patient.deceased.deceasedDateTime.value) : null; | ||
if (deceased) { | ||
end = ((_c = (_b = patient === null || patient === void 0 ? void 0 : patient.deceased) === null || _b === void 0 ? void 0 : _b.deceasedDateTime) === null || _c === void 0 ? void 0 : _c.value) ? new Date(patient.deceased.deceasedDateTime.value) : null; | ||
} | ||
@@ -26,0 +26,0 @@ else { |
@@ -98,3 +98,3 @@ "use strict"; | ||
it('returns empty string when birth date is not specified', function () { | ||
expect(patient_1.formatPatientAge(patient)).toEqual(''); | ||
expect(patient_1.formatPatientAge(patient, false)).toEqual(''); | ||
}); | ||
@@ -109,3 +109,3 @@ it('returns formatted age when birth date is specified (over 18)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('21y'); | ||
expect(patient_1.formatPatientAge(patient, false)).toEqual('21y'); | ||
}); | ||
@@ -122,3 +122,3 @@ it('returns formatted age when birth date is specified (under 18 and over 2)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual("15y " + currentMonth + "m"); | ||
expect(patient_1.formatPatientAge(patient, false)).toEqual("15y " + currentMonth + "m"); | ||
}); | ||
@@ -137,3 +137,3 @@ it('returns formatted age when birth date is specified (under 2 and over 1)', function () { | ||
var expectedText = days === 0 ? '12m' : "12m " + days + "d"; | ||
expect(patient_1.formatPatientAge(patient)).toEqual(expectedText); | ||
expect(patient_1.formatPatientAge(patient, false)).toEqual(expectedText); | ||
}); | ||
@@ -148,3 +148,3 @@ it('returns formatted age when birth date is specified (under 1 and over 4 weeks)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('5w 1d'); | ||
expect(patient_1.formatPatientAge(patient, false)).toEqual('5w 1d'); | ||
}); | ||
@@ -159,3 +159,3 @@ it('returns formatted age when birth date is specified (under 4 weeks and over 2 days)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('14d'); | ||
expect(patient_1.formatPatientAge(patient, false)).toEqual('14d'); | ||
}); | ||
@@ -170,3 +170,3 @@ it('returns formatted age when birth date is specified (under 4 weeks and over 2 days)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('14d'); | ||
expect(patient_1.formatPatientAge(patient, false)).toEqual('14d'); | ||
}); | ||
@@ -181,3 +181,3 @@ it('returns formatted age when birth date is specified (under 2 days and over 2 hours)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('5hrs'); | ||
expect(patient_1.formatPatientAge(patient, false)).toEqual('5hrs'); | ||
}); | ||
@@ -192,3 +192,3 @@ it('returns formatted age when birth date is specified (under 2 hours)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('60min'); | ||
expect(patient_1.formatPatientAge(patient, false)).toEqual('60min'); | ||
}); | ||
@@ -204,3 +204,3 @@ it('returns empty string when patient is deceased and birth date is not specified', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual(''); | ||
expect(patient_1.formatPatientAge(patient, true)).toEqual(''); | ||
}); | ||
@@ -222,3 +222,3 @@ it('returns formatted age when patient is deceased', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('45y'); | ||
expect(patient_1.formatPatientAge(patient, true)).toEqual('45y'); | ||
}); | ||
@@ -241,3 +241,3 @@ it('returns formatted age when patient is deceased (under 18 and over 2)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual("15y " + dod.getMonth() + "m"); | ||
expect(patient_1.formatPatientAge(patient, true)).toEqual("15y " + dod.getMonth() + "m"); | ||
}); | ||
@@ -262,3 +262,3 @@ it('returns formatted age when patient is deceased (under 2 and over 1)', function () { | ||
var expectedText = days === 0 ? '12m' : "12m " + days + "d"; | ||
expect(patient_1.formatPatientAge(patient)).toEqual(expectedText); | ||
expect(patient_1.formatPatientAge(patient, true)).toEqual(expectedText); | ||
}); | ||
@@ -280,3 +280,3 @@ it('returns formatted age when patient is deceased (under 1 and over 4 weeks)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('6w 2d'); | ||
expect(patient_1.formatPatientAge(patient, true)).toEqual('6w 2d'); | ||
}); | ||
@@ -298,3 +298,3 @@ it('returns formatted age when patient is deceased (under 4 weeks and over 2 days)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('17d'); | ||
expect(patient_1.formatPatientAge(patient, true)).toEqual('17d'); | ||
}); | ||
@@ -316,3 +316,3 @@ it('returns formatted age when patient is deceased (under 2 days and over 2 hours)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('27hrs'); | ||
expect(patient_1.formatPatientAge(patient, true)).toEqual('27hrs'); | ||
}); | ||
@@ -334,3 +334,3 @@ it('returns formatted age when patient is deceased (under 2 hours)', function () { | ||
}; | ||
expect(patient_1.formatPatientAge(patient)).toEqual('95min'); | ||
expect(patient_1.formatPatientAge(patient, true)).toEqual('95min'); | ||
}); | ||
@@ -337,0 +337,0 @@ }); |
{ | ||
"name": "@ltht-react/utils", | ||
"version": "1.1.47", | ||
"version": "1.1.48", | ||
"description": "> TODO: description", | ||
@@ -25,5 +25,5 @@ "author": "Jonny Smith <jonny.asmith@gmail.com>", | ||
"dependencies": { | ||
"@ltht-react/types": "^1.0.45" | ||
"@ltht-react/types": "^1.0.46" | ||
}, | ||
"gitHead": "e1bfcfe4f0372196b318461ecf6c65dd2cb275dc" | ||
"gitHead": "6c2f063ed67ae619a84c5206d20b909b5c20af2b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110223
Updated@ltht-react/types@^1.0.46