date-vir 5.1.3 → 5.2.0
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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getNowInUserTimezone = exports.getNowInIsoString = void 0;
|
|
3
|
+
exports.getNowInUtcTimezone = exports.getNowInUserTimezone = exports.getNowInIsoString = void 0;
|
|
4
4
|
const timestamp_1 = require("../formatting/timestamp");
|
|
5
5
|
const create_full_date_1 = require("../full-date/create-full-date");
|
|
6
6
|
const timezones_1 = require("../timezone/timezones");
|
|
@@ -16,3 +16,7 @@ function getNowInUserTimezone() {
|
|
|
16
16
|
return (0, create_full_date_1.getNowFullDate)(timezones_1.userTimezone);
|
|
17
17
|
}
|
|
18
18
|
exports.getNowInUserTimezone = getNowInUserTimezone;
|
|
19
|
+
function getNowInUtcTimezone() {
|
|
20
|
+
return (0, create_full_date_1.getNowFullDate)(timezones_1.utcTimezone);
|
|
21
|
+
}
|
|
22
|
+
exports.getNowInUtcTimezone = getNowInUtcTimezone;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toRelativeString = void 0;
|
|
4
4
|
const common_1 = require("@augment-vir/common");
|
|
5
|
+
const run_time_assertions_1 = require("run-time-assertions");
|
|
5
6
|
const diff_dates_1 = require("../date-operations/diff-dates");
|
|
6
7
|
const duration_unit_1 = require("../duration/duration-unit");
|
|
7
8
|
const maxDurations = {
|
|
@@ -43,7 +44,7 @@ function toRelativeString({ fullDate, relativeTo, options = {}, }) {
|
|
|
43
44
|
const shouldUseJustNow = options.blockJustNow
|
|
44
45
|
? false
|
|
45
46
|
: (unitToUse == undefined && allUnitDiffs.minutes < 2) ||
|
|
46
|
-
(0,
|
|
47
|
+
(0, run_time_assertions_1.isJsonEqual)(fullDate, relativeTo) ||
|
|
47
48
|
(unitToUse === duration_unit_1.DurationUnit.Minutes &&
|
|
48
49
|
options.blockedRelativeUnits?.includes(duration_unit_1.DurationUnit.Seconds) &&
|
|
49
50
|
allUnitDiffs.minutes < 2) ||
|
|
@@ -2,3 +2,4 @@ import { UtcIsoString } from '../formatting/string-format-types';
|
|
|
2
2
|
import { FullDate } from '../full-date/full-date-shape';
|
|
3
3
|
export declare function getNowInIsoString(): UtcIsoString;
|
|
4
4
|
export declare function getNowInUserTimezone(): FullDate;
|
|
5
|
+
export declare function getNowInUtcTimezone(): FullDate;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mapObjectValues, round } from '@augment-vir/common';
|
|
2
|
+
import { isJsonEqual } from 'run-time-assertions';
|
|
2
3
|
import { DiffType, diffDates } from '../date-operations/diff-dates';
|
|
3
4
|
import { DurationUnit, orderedDurationUnits, singularDurationUnitNames, } from '../duration/duration-unit';
|
|
4
5
|
const maxDurations = {
|
|
@@ -40,7 +41,7 @@ export function toRelativeString({ fullDate, relativeTo, options = {}, }) {
|
|
|
40
41
|
const shouldUseJustNow = options.blockJustNow
|
|
41
42
|
? false
|
|
42
43
|
: (unitToUse == undefined && allUnitDiffs.minutes < 2) ||
|
|
43
|
-
|
|
44
|
+
isJsonEqual(fullDate, relativeTo) ||
|
|
44
45
|
(unitToUse === DurationUnit.Minutes &&
|
|
45
46
|
options.blockedRelativeUnits?.includes(DurationUnit.Seconds) &&
|
|
46
47
|
allUnitDiffs.minutes < 2) ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "date-vir",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Easy and explicit dates and times",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"date",
|
|
@@ -41,27 +41,27 @@
|
|
|
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": "^
|
|
44
|
+
"@augment-vir/common": "^28.0.0",
|
|
45
45
|
"@types/luxon": "^3.4.2",
|
|
46
46
|
"luxon": "^3.4.4",
|
|
47
47
|
"object-shape-tester": "^2.3.2",
|
|
48
|
-
"type-fest": "^4.
|
|
48
|
+
"type-fest": "^4.18.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@augment-vir/browser": "^
|
|
52
|
-
"@augment-vir/browser-testing": "^
|
|
51
|
+
"@augment-vir/browser": "^28.0.0",
|
|
52
|
+
"@augment-vir/browser-testing": "^28.0.0",
|
|
53
53
|
"@open-wc/testing": "^4.0.0",
|
|
54
|
-
"@types/chai": "^4.3.
|
|
54
|
+
"@types/chai": "^4.3.16",
|
|
55
55
|
"@types/mocha": "^10.0.6",
|
|
56
56
|
"@web/dev-server-esbuild": "^1.0.2",
|
|
57
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.
|
|
62
|
-
"dependency-cruiser": "^16.2
|
|
63
|
-
"element-vir": "^
|
|
64
|
-
"esbuild": "^0.
|
|
61
|
+
"cspell": "^8.8.1",
|
|
62
|
+
"dependency-cruiser": "^16.3.2",
|
|
63
|
+
"element-vir": "^22.2.2",
|
|
64
|
+
"esbuild": "^0.21.1",
|
|
65
65
|
"istanbul-smart-text-reporter": "^1.1.4",
|
|
66
66
|
"markdown-code-example-inserter": "^1.0.0",
|
|
67
67
|
"npm-check-updates": "~16.12.3",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"prettier-plugin-jsdoc": "^1.3.0",
|
|
71
71
|
"prettier-plugin-multiline-arrays": "^3.0.4",
|
|
72
72
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
73
|
-
"prettier-plugin-packagejson": "^2.
|
|
74
|
-
"prettier-plugin-sort-json": "^
|
|
73
|
+
"prettier-plugin-packagejson": "^2.5.0",
|
|
74
|
+
"prettier-plugin-sort-json": "^4.0.0",
|
|
75
75
|
"prettier-plugin-toml": "^2.0.1",
|
|
76
|
-
"run-time-assertions": "^1.
|
|
77
|
-
"typedoc": "^0.25.
|
|
78
|
-
"typescript": "^5.4.
|
|
79
|
-
"virmator": "^11.
|
|
76
|
+
"run-time-assertions": "^1.5.0",
|
|
77
|
+
"typedoc": "^0.25.13",
|
|
78
|
+
"typescript": "^5.4.5",
|
|
79
|
+
"virmator": "^11.5.2"
|
|
80
80
|
}
|
|
81
81
|
}
|