@ecrvs/opencrvs-toolkit 1.9.0-rc.47deb60 → 1.9.0-rc.64705da

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.
@@ -4461,12 +4461,13 @@ ajv.addKeyword({
4461
4461
  const dod = data?.[deathDateField];
4462
4462
  const tod = data?.[deathTimeField];
4463
4463
  const ageValue = data?.[ageField];
4464
- if (!ageValue || !isValidDateFormat(dob) || !isValidDateFormat(dod)) {
4464
+ if (!ageValue || !isValidDateFormat(dob) || !isValidDateFormat(dod) || !dod || !dob) {
4465
4465
  return true;
4466
4466
  }
4467
4467
  const dateOfBirth = /* @__PURE__ */ new Date(`${dob}T00:00:00+00:00`);
4468
4468
  const dateOfDeath = tod ? /* @__PURE__ */ new Date(`${dod}T${tod}:00+00:00`) : /* @__PURE__ */ new Date(`${dod}T00:00:00+00:00`);
4469
4469
  const deceasedAge = getAgeOfDeceased(dateOfBirth, dateOfDeath, format3);
4470
+ console.log(dob, dod, tod, ageValue, deceasedAge);
4470
4471
  const sameDay = dateOfBirth.toISOString().slice(0, 10) === dateOfDeath.toISOString().slice(0, 10);
4471
4472
  return Number(ageValue) === deceasedAge && !(format3 === "hours" && !sameDay) && !(format3 === "minutes" && !sameDay) || format3 === "days" && deceasedAge - Number(ageValue) === 1 || format3 === "hours" && !sameDay && deceasedAge < Number(ageValue) || format3 === "hours" && sameDay && !tod || format3 === "minutes" && !sameDay && deceasedAge < Number(ageValue) || format3 === "minutes" && sameDay && !tod;
4472
4473
  }
@@ -3700,12 +3700,13 @@ ajv.addKeyword({
3700
3700
  const dod = data?.[deathDateField];
3701
3701
  const tod = data?.[deathTimeField];
3702
3702
  const ageValue = data?.[ageField];
3703
- if (!ageValue || !isValidDateFormat(dob) || !isValidDateFormat(dod)) {
3703
+ if (!ageValue || !isValidDateFormat(dob) || !isValidDateFormat(dod) || !dod || !dob) {
3704
3704
  return true;
3705
3705
  }
3706
3706
  const dateOfBirth = /* @__PURE__ */ new Date(`${dob}T00:00:00+00:00`);
3707
3707
  const dateOfDeath = tod ? /* @__PURE__ */ new Date(`${dod}T${tod}:00+00:00`) : /* @__PURE__ */ new Date(`${dod}T00:00:00+00:00`);
3708
3708
  const deceasedAge = getAgeOfDeceased(dateOfBirth, dateOfDeath, format3);
3709
+ console.log(dob, dod, tod, ageValue, deceasedAge);
3709
3710
  const sameDay = dateOfBirth.toISOString().slice(0, 10) === dateOfDeath.toISOString().slice(0, 10);
3710
3711
  return Number(ageValue) === deceasedAge && !(format3 === "hours" && !sameDay) && !(format3 === "minutes" && !sameDay) || format3 === "days" && deceasedAge - Number(ageValue) === 1 || format3 === "hours" && !sameDay && deceasedAge < Number(ageValue) || format3 === "hours" && sameDay && !tod || format3 === "minutes" && !sameDay && deceasedAge < Number(ageValue) || format3 === "minutes" && sameDay && !tod;
3711
3712
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecrvs/opencrvs-toolkit",
3
- "version": "1.9.0-rc.47deb60",
3
+ "version": "1.9.0-rc.64705da",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {