date-vir 5.1.1 → 5.1.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.
@@ -42,9 +42,14 @@ function toRelativeString({ fullDate, relativeTo, options = {}, }) {
42
42
  }, undefined);
43
43
  const shouldUseJustNow = options.blockJustNow
44
44
  ? false
45
- : (0, common_1.areJsonEqual)(fullDate, relativeTo) ||
46
- (unitToUse === duration_unit_1.DurationUnit.Minutes && allUnitDiffs.minutes < 2) ||
47
- (unitToUse === duration_unit_1.DurationUnit.Seconds && allUnitDiffs.seconds < 11) ||
45
+ : (unitToUse == undefined && allUnitDiffs.minutes < 2) ||
46
+ (0, common_1.areJsonEqual)(fullDate, relativeTo) ||
47
+ (unitToUse === duration_unit_1.DurationUnit.Minutes &&
48
+ options.blockedRelativeUnits?.includes(duration_unit_1.DurationUnit.Seconds) &&
49
+ allUnitDiffs.minutes < 2) ||
50
+ (unitToUse === duration_unit_1.DurationUnit.Seconds &&
51
+ options.blockedRelativeUnits?.includes(duration_unit_1.DurationUnit.Milliseconds) &&
52
+ allUnitDiffs.seconds < 11) ||
48
53
  (unitToUse === duration_unit_1.DurationUnit.Milliseconds && allUnitDiffs.milliseconds < 710);
49
54
  /** Some short circuits. */
50
55
  if (shouldUseJustNow) {
@@ -39,9 +39,14 @@ export function toRelativeString({ fullDate, relativeTo, options = {}, }) {
39
39
  }, undefined);
40
40
  const shouldUseJustNow = options.blockJustNow
41
41
  ? false
42
- : areJsonEqual(fullDate, relativeTo) ||
43
- (unitToUse === DurationUnit.Minutes && allUnitDiffs.minutes < 2) ||
44
- (unitToUse === DurationUnit.Seconds && allUnitDiffs.seconds < 11) ||
42
+ : (unitToUse == undefined && allUnitDiffs.minutes < 2) ||
43
+ areJsonEqual(fullDate, relativeTo) ||
44
+ (unitToUse === DurationUnit.Minutes &&
45
+ options.blockedRelativeUnits?.includes(DurationUnit.Seconds) &&
46
+ allUnitDiffs.minutes < 2) ||
47
+ (unitToUse === DurationUnit.Seconds &&
48
+ options.blockedRelativeUnits?.includes(DurationUnit.Milliseconds) &&
49
+ allUnitDiffs.seconds < 11) ||
45
50
  (unitToUse === DurationUnit.Milliseconds && allUnitDiffs.milliseconds < 710);
46
51
  /** Some short circuits. */
47
52
  if (shouldUseJustNow) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "date-vir",
3
- "version": "5.1.1",
3
+ "version": "5.1.3",
4
4
  "description": "Easy and explicit dates and times",
5
5
  "keywords": [
6
6
  "date",
@@ -41,41 +41,41 @@
41
41
  "test:watch": "web-test-runner --watch --color --config configs/web-test-runner.config.mjs"
42
42
  },
43
43
  "dependencies": {
44
- "@augment-vir/common": "^22.4.0",
45
- "@types/luxon": "^3.4.1",
44
+ "@augment-vir/common": "^25.0.0",
45
+ "@types/luxon": "^3.4.2",
46
46
  "luxon": "^3.4.4",
47
- "object-shape-tester": "^1.0.3",
48
- "type-fest": "^4.9.0"
47
+ "object-shape-tester": "^2.3.2",
48
+ "type-fest": "^4.12.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@augment-vir/browser": "^22.4.0",
52
- "@augment-vir/browser-testing": "^22.4.0",
51
+ "@augment-vir/browser": "^25.0.0",
52
+ "@augment-vir/browser-testing": "^25.0.0",
53
53
  "@open-wc/testing": "^4.0.0",
54
- "@types/chai": "^4.3.11",
54
+ "@types/chai": "^4.3.12",
55
55
  "@types/mocha": "^10.0.6",
56
- "@web/dev-server-esbuild": "^1.0.1",
57
- "@web/test-runner": "^0.18.0",
56
+ "@web/dev-server-esbuild": "^1.0.2",
57
+ "@web/test-runner": "^0.18.1",
58
58
  "@web/test-runner-commands": "^0.9.0",
59
59
  "@web/test-runner-playwright": "^0.11.0",
60
60
  "@web/test-runner-visual-regression": "^0.9.0",
61
- "cspell": "^8.3.2",
62
- "dependency-cruiser": "^16.0.0",
63
- "element-vir": "^20.0.6",
64
- "esbuild": "^0.19.11",
65
- "istanbul-smart-text-reporter": "^1.1.3",
66
- "markdown-code-example-inserter": "^0.3.3",
61
+ "cspell": "^8.6.0",
62
+ "dependency-cruiser": "^16.2.3",
63
+ "element-vir": "^20.0.9",
64
+ "esbuild": "^0.20.2",
65
+ "istanbul-smart-text-reporter": "^1.1.4",
66
+ "markdown-code-example-inserter": "^1.0.0",
67
67
  "npm-check-updates": "~16.12.3",
68
- "prettier": "3.2.2",
69
- "prettier-plugin-interpolated-html-tags": "^1.0.3",
68
+ "prettier": "^3.2.5",
69
+ "prettier-plugin-interpolated-html-tags": "^1.0.5",
70
70
  "prettier-plugin-jsdoc": "^1.3.0",
71
- "prettier-plugin-multiline-arrays": "^3.0.1",
71
+ "prettier-plugin-multiline-arrays": "^3.0.4",
72
72
  "prettier-plugin-organize-imports": "^3.2.4",
73
- "prettier-plugin-packagejson": "^2.4.9",
73
+ "prettier-plugin-packagejson": "^2.4.12",
74
74
  "prettier-plugin-sort-json": "^3.1.0",
75
75
  "prettier-plugin-toml": "^2.0.1",
76
- "run-time-assertions": "^0.3.0",
77
- "typedoc": "^0.25.7",
78
- "typescript": "^5.3.3",
79
- "virmator": "^11.3.1"
76
+ "run-time-assertions": "^1.0.0",
77
+ "typedoc": "^0.25.12",
78
+ "typescript": "^5.4.2",
79
+ "virmator": "^11.4.0"
80
80
  }
81
81
  }