@bgord/tools 0.14.2 → 0.14.3

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/dist/age.vo.js CHANGED
@@ -38,14 +38,12 @@ export class Age {
38
38
  static fromBirthdateTimestamp(params) {
39
39
  if (params.birthdate > params.now)
40
40
  throw new Error("invalid.birthdate_in_future");
41
- const years = differenceInYears(new Date(params.now), new Date(params.birthdate));
42
- return Age.fromValue(years);
41
+ return Age.fromValue(differenceInYears(params.now, params.birthdate));
43
42
  }
44
43
  static fromBirthdate(params) {
45
44
  const birthdate = new Date(params.birthdate).getTime();
46
45
  if (birthdate > params.now)
47
46
  throw new Error("invalid.birthdate_in_future");
48
- const years = differenceInYears(new Date(params.now), new Date(birthdate));
49
- return Age.fromValue(years);
47
+ return Age.fromValue(differenceInYears(params.now, birthdate));
50
48
  }
51
49
  }
@@ -1 +1 @@
1
- {"root":["../src/age.vo.ts","../src/api-key.vo.ts","../src/basename.vo.ts","../src/clock.vo.ts","../src/date-calculator.service.ts","../src/date-formatter.service.ts","../src/date-range.vo.ts","../src/dates-of-the-week.vo.ts","../src/day-iso-id.vo.ts","../src/day.vo.ts","../src/directory-path-absolute.vo.ts","../src/directory-path-relative.vo.ts","../src/dll.service.ts","../src/email-mask.service.ts","../src/etags.vo.ts","../src/extension.vo.ts","../src/feature-flag.vo.ts","../src/file-path-absolute-schema.vo.ts","../src/file-path-relative-schema.vo.ts","../src/file-path.vo.ts","../src/filename-from-string.vo.ts","../src/filename-suffix.vo.ts","../src/filename.vo.ts","../src/height.vo.ts","../src/hour.vo.ts","../src/iban-mask.service.ts","../src/iban.vo.ts","../src/image.vo.ts","../src/index.ts","../src/language.vo.ts","../src/mean.service.ts","../src/mime-types.vo.ts","../src/mime.vo.ts","../src/min-max-scaler.service.ts","../src/minute.vo.ts","../src/money.vo.ts","../src/month-iso-id.vo.ts","../src/month.vo.ts","../src/noop.service.ts","../src/notification-template.vo.ts","../src/object-key.vo.ts","../src/outlier-detector.service.ts","../src/package-version.vo.ts","../src/pagination.service.ts","../src/percentage.service.ts","../src/population-standard-deviation.service.ts","../src/quarter-iso-id.vo.ts","../src/quarter.vo.ts","../src/random.service.ts","../src/rate-limiter.service.ts","../src/relative-date.vo.ts","../src/reordering.service.ts","../src/revision.vo.ts","../src/rounding.service.ts","../src/simple-linear-regression.service.ts","../src/size.vo.ts","../src/stepper.service.ts","../src/stopwatch.service.ts","../src/streak-calculator.service.ts","../src/sum.service.ts","../src/thousands-separator.service.ts","../src/time-zone-offset-value.vo.ts","../src/time.service.ts","../src/timestamp.vo.ts","../src/timezone.vo.ts","../src/ts-utils.ts","../src/visually-unambiguous-characters-generator.service.ts","../src/week-iso-id.vo.ts","../src/week.vo.ts","../src/weekday.vo.ts","../src/weight.vo.ts","../src/year-iso-id.vo.ts","../src/year.vo.ts","../src/z-score.service.ts"],"version":"5.9.2"}
1
+ {"root":["../src/age.vo.ts","../src/api-key.vo.ts","../src/basename.vo.ts","../src/clock.vo.ts","../src/date-calculator.service.ts","../src/date-formatter.service.ts","../src/date-range.vo.ts","../src/dates-of-the-week.vo.ts","../src/day-iso-id.vo.ts","../src/day.vo.ts","../src/directory-path-absolute.vo.ts","../src/directory-path-relative.vo.ts","../src/dll.service.ts","../src/email-mask.service.ts","../src/etags.vo.ts","../src/extension.vo.ts","../src/feature-flag.vo.ts","../src/file-path-absolute-schema.vo.ts","../src/file-path-relative-schema.vo.ts","../src/file-path.vo.ts","../src/filename-from-string.vo.ts","../src/filename-suffix.vo.ts","../src/filename.vo.ts","../src/height.vo.ts","../src/hour.vo.ts","../src/iban-mask.service.ts","../src/iban.vo.ts","../src/image.vo.ts","../src/index.ts","../src/language.vo.ts","../src/mean.service.ts","../src/mime-types.vo.ts","../src/mime.vo.ts","../src/min-max-scaler.service.ts","../src/minute.vo.ts","../src/money.vo.ts","../src/month-iso-id.vo.ts","../src/month.vo.ts","../src/noop.service.ts","../src/notification-template.vo.ts","../src/object-key.vo.ts","../src/outlier-detector.service.ts","../src/package-version.vo.ts","../src/pagination.service.ts","../src/percentage.service.ts","../src/population-standard-deviation.service.ts","../src/quarter-iso-id.vo.ts","../src/quarter.vo.ts","../src/random.service.ts","../src/rate-limiter.service.ts","../src/relative-date.vo.ts","../src/reordering.service.ts","../src/revision.vo.ts","../src/rounding.service.ts","../src/simple-linear-regression.service.ts","../src/size.vo.ts","../src/stepper.service.ts","../src/stopwatch.service.ts","../src/streak-calculator.service.ts","../src/sum.service.ts","../src/thousands-separator.service.ts","../src/time-zone-offset-value.vo.ts","../src/time.service.ts","../src/timestamp.vo.ts","../src/timezone.vo.ts","../src/ts-utils.ts","../src/visually-unambiguous-characters-generator.service.ts","../src/week-iso-id.vo.ts","../src/week.vo.ts","../src/weekday.vo.ts","../src/weight.vo.ts","../src/year-iso-id.vo.ts","../src/year.vo.ts","../src/z-score.service.ts"],"version":"5.9.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgord/tools",
3
- "version": "0.14.2",
3
+ "version": "0.14.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Bartosz Gordon",
@@ -31,7 +31,7 @@
31
31
  "lefthook": "1.13.6",
32
32
  "only-allow": "1.2.1",
33
33
  "shellcheck": "4.1.0",
34
- "typescript": "5.9.2",
34
+ "typescript": "5.9.3",
35
35
  "zod": "4.1.11"
36
36
  },
37
37
  "dependencies": {
package/src/age.vo.ts CHANGED
@@ -47,19 +47,13 @@ export class Age {
47
47
 
48
48
  static fromBirthdateTimestamp(params: { birthdate: TimestampType; now: TimestampType }): Age {
49
49
  if (params.birthdate > params.now) throw new Error("invalid.birthdate_in_future");
50
-
51
- const years = differenceInYears(new Date(params.now), new Date(params.birthdate));
52
-
53
- return Age.fromValue(years);
50
+ return Age.fromValue(differenceInYears(params.now, params.birthdate));
54
51
  }
55
52
 
56
53
  static fromBirthdate(params: { birthdate: string; now: TimestampType }): Age {
57
54
  const birthdate = new Date(params.birthdate).getTime();
58
55
 
59
56
  if (birthdate > params.now) throw new Error("invalid.birthdate_in_future");
60
-
61
- const years = differenceInYears(new Date(params.now), new Date(birthdate));
62
-
63
- return Age.fromValue(years);
57
+ return Age.fromValue(differenceInYears(params.now, birthdate));
64
58
  }
65
59
  }