date-vir 7.3.1 → 7.3.2

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/README.md CHANGED
@@ -9,7 +9,7 @@ Full docs: http://electrovir.github.io/date-vir
9
9
  <!-- example-link: src/readme-examples/full-date.example.ts -->
10
10
 
11
11
  ```TypeScript
12
- import {FullDate, utcTimezone} from 'date-vir';
12
+ import {type FullDate, utcTimezone} from 'date-vir';
13
13
 
14
14
  const myDate: FullDate = {
15
15
  year: 2023,
@@ -1,6 +1,6 @@
1
- import type { AnyDuration } from '@date-vir/duration';
2
- import { FullDate } from '../full-date/full-date-shape.js';
3
- import { Timezone } from '../timezone/timezones.js';
1
+ import { type AnyDuration } from '@date-vir/duration';
2
+ import { type FullDate } from '../full-date/full-date-shape.js';
3
+ import { type Timezone } from '../timezone/timezones.js';
4
4
  /**
5
5
  * Calculates a new date starting at the given fullDate and adding the given offsets. Offsets can be
6
6
  * negative to go backwards in time.
@@ -1,6 +1,6 @@
1
- import type { FullDatePart } from '../full-date/full-date-parts.js';
2
- import { DatePart, FullDate, TimePart } from '../full-date/full-date-shape.js';
3
- import type { Timezone } from '../timezone/timezones.js';
1
+ import { type FullDatePart } from '../full-date/full-date-parts.js';
2
+ import { type DatePart, type FullDate, type TimePart } from '../full-date/full-date-shape.js';
3
+ import { type Timezone } from '../timezone/timezones.js';
4
4
  /**
5
5
  * An object containing date and/or time parts or neither. Used for {@link combineDateParts}
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { DateUnit } from '@date-vir/duration';
2
2
  import { type FullDate } from '../full-date/full-date-shape.js';
3
- import { Timezone } from '../timezone/timezones.js';
3
+ import { type Timezone } from '../timezone/timezones.js';
4
4
  /**
5
5
  * Get the {@link DateUnit} value of a {@link FullDate}.
6
6
  *
@@ -1,5 +1,5 @@
1
1
  import { type DurationBySelection, type DurationUnitSelection, type RoundOptions } from '@date-vir/duration';
2
- import { FullDate } from '../full-date/full-date-shape.js';
2
+ import { type FullDate } from '../full-date/full-date-shape.js';
3
3
  /**
4
4
  * Diffs two dates and returns the diff in the specified unit or units. When a multiple units are
5
5
  * provided with the `units` input property, an array is returned with the full diff duration
@@ -1,6 +1,6 @@
1
1
  import { type PartialWithUndefined, type SetRequiredAndNotNull } from '@augment-vir/common';
2
2
  import { type FullDate } from '../full-date/full-date-shape.js';
3
- import type { Timezone } from '../timezone/timezones.js';
3
+ import { type Timezone } from '../timezone/timezones.js';
4
4
  /**
5
5
  * Checks that the input has all the requested {@link FullDate} keys.
6
6
  *
@@ -1,4 +1,4 @@
1
- import { FullDate } from '../full-date/full-date-shape.js';
1
+ import { type FullDate } from '../full-date/full-date-shape.js';
2
2
  /**
3
3
  * Convert a {@link FullDate} from a built-in JS
4
4
  * [`Date`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date).
@@ -1,6 +1,6 @@
1
- import { UtcIsoString } from '../formatting/string-format-types.js';
2
- import { FullDate } from '../full-date/full-date-shape.js';
3
- import { Timezone, UtcTimezone } from '../timezone/timezones.js';
1
+ import { type UtcIsoString } from '../formatting/string-format-types.js';
2
+ import { type FullDate } from '../full-date/full-date-shape.js';
3
+ import { type Timezone, type UtcTimezone } from '../timezone/timezones.js';
4
4
  /**
5
5
  * Get the time right now as a UTC ISO.
6
6
  *
@@ -1,5 +1,5 @@
1
- import { FullDate } from '../full-date/full-date-shape.js';
2
- import { Timezone } from '../timezone/timezones.js';
1
+ import { type FullDate } from '../full-date/full-date-shape.js';
2
+ import { type Timezone } from '../timezone/timezones.js';
3
3
  /**
4
4
  * Override the initial provided FullDate with all subsequent FullDate parts.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { TimeKey } from '../full-date/full-date-parts.js';
2
- import { FullDate } from '../full-date/full-date-shape.js';
3
- import { Timezone } from '../timezone/timezones.js';
2
+ import { type FullDate } from '../full-date/full-date-shape.js';
3
+ import { type Timezone } from '../timezone/timezones.js';
4
4
  /**
5
5
  * A {@link FullDate} instance that has the lowest, valid, non-negative, value for each property.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { FullDatePart } from '../full-date/full-date-parts.js';
2
- import { DatePart, FullDate } from '../full-date/full-date-shape.js';
3
- import { DateTimeString, DateTimeWithSeconds, JustDateString, JustTimeString, JustTimeWithSecondsString } from './string-format-types.js';
2
+ import { type DatePart, type FullDate } from '../full-date/full-date-shape.js';
3
+ import { type DateTimeString, type DateTimeWithSeconds, type JustDateString, type JustTimeString, type JustTimeWithSecondsString } from './string-format-types.js';
4
4
  /**
5
5
  * Only the date part of a {@link FullDate}, without timezone.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { type PartialWithUndefined } from '@augment-vir/common';
2
- import { AnyDuration, DurationUnitSelection } from '@date-vir/duration';
3
- import { FullDate } from '../full-date/full-date-shape.js';
2
+ import { type AnyDuration, type DurationUnitSelection } from '@date-vir/duration';
3
+ import { type FullDate } from '../full-date/full-date-shape.js';
4
4
  /**
5
5
  * Options for {@link toRelativeString}.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { check } from '@augment-vir/assert';
2
2
  import { arrayToObject, filterMap } from '@augment-vir/common';
3
- import { DurationUnit, convertDuration, flattenUnitSelection, singularDurationUnitNames, } from '@date-vir/duration';
3
+ import { convertDuration, DurationUnit, flattenUnitSelection, singularDurationUnitNames, } from '@date-vir/duration';
4
4
  import { diffDates } from '../date-operations/diff-dates.js';
5
5
  const defaultJustNowThresholds = {
6
6
  minutes: 1.5,
@@ -62,6 +62,7 @@ export function toRelativeString(datesOrDuration, units, options = {}) {
62
62
  return 'just now';
63
63
  }
64
64
  else if (options.useOnlyLargestUnit) {
65
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
65
66
  if (!unitValues[0]) {
66
67
  return '';
67
68
  }
@@ -1,6 +1,6 @@
1
- import type { SetOptionalAndNullable } from '@augment-vir/common';
2
- import { FullDate } from '../full-date/full-date-shape.js';
3
- import { JustDateString, JustTimeString, JustTimeWithSecondsString } from './string-format-types.js';
1
+ import { type SetOptionalAndNullable } from '@augment-vir/common';
2
+ import { type FullDate } from '../full-date/full-date-shape.js';
3
+ import { type JustDateString, type JustTimeString, type JustTimeWithSecondsString } from './string-format-types.js';
4
4
  /**
5
5
  * Create a string based on just the date parts of a FullDate.
6
6
  *
@@ -1,5 +1,5 @@
1
- import { FullDate } from '../full-date/full-date-shape.js';
2
- import { UtcIsoString } from './string-format-types.js';
1
+ import { type FullDate } from '../full-date/full-date-shape.js';
2
+ import { type UtcIsoString } from './string-format-types.js';
3
3
  /**
4
4
  * Convert a FullDate into a unix timestamp with milliseconds.
5
5
  *
@@ -1,6 +1,6 @@
1
- import { Timezone, UtcTimezone } from '../timezone/timezones.js';
2
- import { DateLike } from './date-like.js';
3
- import { FullDate } from './full-date-shape.js';
1
+ import { type Timezone, type UtcTimezone } from '../timezone/timezones.js';
2
+ import { type DateLike } from './date-like.js';
3
+ import { type FullDate } from './full-date-shape.js';
4
4
  /**
5
5
  * Parses the given {@link DateLike} and converts it into a {@link FullDate} instance with the user's
6
6
  * current timezone.
@@ -1,6 +1,6 @@
1
- import { DateTime } from 'luxon';
2
- import { Timezone } from '../timezone/timezones.js';
3
- import { FullDate } from './full-date-shape.js';
1
+ import { type DateTime } from 'luxon';
2
+ import { type Timezone } from '../timezone/timezones.js';
3
+ import { type FullDate } from './full-date-shape.js';
4
4
  /**
5
5
  * Types that can be converted into {@link FullDate} instances.
6
6
  *
@@ -1,6 +1,6 @@
1
- import { Overwrite, type SetRequired } from '@augment-vir/common';
1
+ import { type Overwrite, type SetRequired } from '@augment-vir/common';
2
2
  import { type DayOfMonth, type Hour, type Minute, type MonthNumber, type Second } from '@date-vir/duration';
3
- import type { Simplify } from 'type-fest';
3
+ import { type Simplify } from 'type-fest';
4
4
  import { Timezone } from '../timezone/timezones.js';
5
5
  /**
6
6
  * Time part of {@link FullDate} represented in a shape definition.
@@ -1,5 +1,5 @@
1
- import { Timezone } from '../timezone/timezones.js';
2
- import { FullDate } from './full-date-shape.js';
1
+ import { type Timezone } from '../timezone/timezones.js';
2
+ import { type FullDate } from './full-date-shape.js';
3
3
  /**
4
4
  * Asserts that the input is a valid {@link FullDate}.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { DateTime } from 'luxon';
2
- import { Timezone } from '../timezone/timezones.js';
3
- import { FullDate } from './full-date-shape.js';
2
+ import { type Timezone } from '../timezone/timezones.js';
3
+ import { type FullDate } from './full-date-shape.js';
4
4
  /**
5
5
  * Converts a {@link FullDate} object into a Luxon DateTime library. This is only needed if you need
6
6
  * complex operations on dates. It does, however, internally power a lot of date-vir functionality
@@ -1,5 +1,5 @@
1
- import { Timezone } from '../timezone/timezones.js';
2
- import { FullDate } from './full-date-shape.js';
1
+ import { type Timezone } from '../timezone/timezones.js';
2
+ import { type FullDate } from './full-date-shape.js';
3
3
  /**
4
4
  * Parses any date string into a {@link FullDate} using the specified pattern and timezone. Prefer
5
5
  * using {@link createFullDate} if possible.
@@ -1,5 +1,5 @@
1
1
  import { DateTime } from 'luxon';
2
- import { Timezone } from '../timezone/timezones.js';
2
+ import { type Timezone } from '../timezone/timezones.js';
3
3
  /**
4
4
  * Tries extra known formats for parsing date strings, even those that browsers do not natively
5
5
  * support.
@@ -10,6 +10,18 @@ const knownStringFormats = [
10
10
  'LLL-y',
11
11
  // january-2021
12
12
  'LLLL-y',
13
+ // no padding
14
+ // Sat, 1 Jun 2025 6:23:21 +0000 (UTC)
15
+ 'ccc, d LLL y H:mm:ss ZZZ (z)',
16
+ // all padding
17
+ // Sat, 01 Jun 2025 06:23:21 +0000 (UTC)
18
+ 'ccc, dd LLL y HH:mm:ss ZZZ (z)',
19
+ // padded day
20
+ // Sat, 01 Jun 2025 6:23:21 +0000 (UTC)
21
+ 'ccc, dd LLL y H:mm:ss ZZZ (z)',
22
+ // padded hour
23
+ // Sat, 01 Jun 2025 6:23:21 +0000 (UTC)
24
+ 'ccc, d LLL y HH:mm:ss ZZZ (z)',
13
25
  ];
14
26
  /**
15
27
  * Tries extra known formats for parsing date strings, even those that browsers do not natively
@@ -1,4 +1,4 @@
1
- import { Timezone } from './timezones.js';
1
+ import { type Timezone } from './timezones.js';
2
2
  /**
3
3
  * Asserts that the given input is a valid timezone name.
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { ArrayElement } from '@augment-vir/common';
1
+ import { type ArrayElement } from '@augment-vir/common';
2
2
  import { allTimezoneNames } from './timezone-names.js';
3
3
  /**
4
4
  * All possible timezone names.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "date-vir",
3
- "version": "7.3.1",
3
+ "version": "7.3.2",
4
4
  "description": "Easy and explicit dates and times.",
5
5
  "keywords": [
6
6
  "date",
@@ -34,26 +34,26 @@
34
34
  "test:docs": "virmator docs check"
35
35
  },
36
36
  "dependencies": {
37
- "@augment-vir/assert": "^31.10.0",
38
- "@augment-vir/common": "^31.10.0",
39
- "@date-vir/duration": "^7.3.1",
40
- "@types/luxon": "^3.4.2",
41
- "luxon": "^3.5.0",
42
- "object-shape-tester": "^5.1.5",
43
- "type-fest": "^4.37.0"
37
+ "@augment-vir/assert": "^31.26.0",
38
+ "@augment-vir/common": "^31.26.0",
39
+ "@date-vir/duration": "^7.3.2",
40
+ "@types/luxon": "^3.6.2",
41
+ "luxon": "^3.6.1",
42
+ "object-shape-tester": "^5.1.6",
43
+ "type-fest": "^4.41.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@augment-vir/test": "^31.10.0",
46
+ "@augment-vir/test": "^31.26.0",
47
47
  "@web/dev-server-esbuild": "^1.0.4",
48
- "@web/test-runner": "^0.20.0",
48
+ "@web/test-runner": "^0.20.2",
49
49
  "@web/test-runner-commands": "^0.9.0",
50
- "@web/test-runner-playwright": "^0.11.0",
50
+ "@web/test-runner-playwright": "^0.11.1",
51
51
  "@web/test-runner-visual-regression": "^0.10.0",
52
- "element-vir": "^23.4.2",
52
+ "element-vir": "^26.5.6",
53
53
  "istanbul-smart-text-reporter": "^1.1.5",
54
54
  "markdown-code-example-inserter": "^3.0.3",
55
- "typedoc": "^0.27.9",
56
- "typescript": "^5.8.2"
55
+ "typedoc": "^0.28.6",
56
+ "typescript": "^5.8.3"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=22"