@thi.ng/date 2.7.18 → 2.7.20

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-05-08T18:24:31Z
3
+ - **Last updated**: 2024-06-29T09:28:36Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [2.7.19](https://github.com/thi-ng/umbrella/tree/@thi.ng/date@2.7.19) (2024-06-21)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
17
+ - enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
18
+
12
19
  ### [2.7.9](https://github.com/thi-ng/umbrella/tree/@thi.ng/date@2.7.9) (2024-03-18)
13
20
 
14
21
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 192 standalone projects, maintained as part
10
+ > This is one of 189 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
@@ -68,7 +68,7 @@ For Node.js REPL:
68
68
  const date = await import("@thi.ng/date");
69
69
  ```
70
70
 
71
- Package sizes (brotli'd, pre-treeshake): ESM: 5.43 KB
71
+ Package sizes (brotli'd, pre-treeshake): ESM: 5.42 KB
72
72
 
73
73
  ## Dependencies
74
74
 
package/datetime.d.ts CHANGED
@@ -118,5 +118,5 @@ export declare const ensureDateTime: (x: MaybeDate, prec?: Precision) => DateTim
118
118
  *
119
119
  * @param x -
120
120
  */
121
- export declare const maybeIsDate: (x: any) => boolean;
121
+ export declare const maybeIsDate: (x: any) => x is string | number | DateTime | Date;
122
122
  //# sourceMappingURL=datetime.d.ts.map
package/i18n.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { isString } from "@thi.ng/checks/is-string";
2
2
  import { EN_SHORT } from "./i18n/en.js";
3
- const prepLocale = (spec) => {
3
+ const __prepLocale = (spec) => {
4
4
  const locale = {
5
5
  sepED: " ",
6
6
  sepDM: "/",
@@ -13,7 +13,7 @@ const prepLocale = (spec) => {
13
13
  !locale.dateTime && (locale.dateTime = [...locale.date, ", ", ...locale.time]);
14
14
  return locale;
15
15
  };
16
- const setLocale = (locale) => LOCALE = prepLocale(locale);
16
+ const setLocale = (locale) => LOCALE = __prepLocale(locale);
17
17
  const withLocale = (locale, fn) => {
18
18
  const old = LOCALE;
19
19
  setLocale(locale);
@@ -26,7 +26,7 @@ const withLocale = (locale, fn) => {
26
26
  throw e;
27
27
  }
28
28
  };
29
- let LOCALE = prepLocale(EN_SHORT);
29
+ let LOCALE = __prepLocale(EN_SHORT);
30
30
  const weekdayNames = () => LOCALE.days.slice();
31
31
  const monthNames = () => LOCALE.months.slice();
32
32
  const units = (x, unit, isDativ = false, unitsOnly = false) => {
package/iterators.js CHANGED
@@ -2,8 +2,8 @@ import { isString } from "@thi.ng/checks/is-string";
2
2
  import { DateTime } from "./datetime.js";
3
3
  import { floorQuarter, floorWeek } from "./round.js";
4
4
  const defIterator = (prec, tick) => {
5
- return function* (...xs) {
6
- let [from, to] = (xs.length > 1 ? xs : xs[0]).map(
5
+ return function* (...args) {
6
+ let [from, to] = (args.length > 1 ? args : args[0]).map(
7
7
  (x) => new DateTime(x).getTime()
8
8
  );
9
9
  let state = isString(prec) ? new DateTime(from, prec) : prec(from);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/date",
3
- "version": "2.7.18",
3
+ "version": "2.7.20",
4
4
  "description": "Datetime types, relative dates, math, iterators, composable formatters, locales",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
12
12
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/date#readme",
13
+ "homepage": "https://thi.ng/date",
14
14
  "funding": [
15
15
  {
16
16
  "type": "github",
@@ -36,15 +36,15 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.11.2",
40
- "@thi.ng/checks": "^3.6.4",
41
- "@thi.ng/strings": "^3.7.33"
39
+ "@thi.ng/api": "^8.11.4",
40
+ "@thi.ng/checks": "^3.6.6",
41
+ "@thi.ng/strings": "^3.7.35"
42
42
  },
43
43
  "devDependencies": {
44
- "@microsoft/api-extractor": "^7.43.2",
45
- "esbuild": "^0.21.1",
44
+ "@microsoft/api-extractor": "^7.47.0",
45
+ "esbuild": "^0.21.5",
46
46
  "typedoc": "^0.25.13",
47
- "typescript": "^5.4.5"
47
+ "typescript": "^5.5.2"
48
48
  },
49
49
  "keywords": [
50
50
  "datastructure",
@@ -132,5 +132,5 @@
132
132
  "thi.ng": {
133
133
  "year": 2020
134
134
  },
135
- "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
135
+ "gitHead": "7b950c112fba0b2e7c450765b15624c3382f1354\n"
136
136
  }
package/relative.js CHANGED
@@ -20,9 +20,9 @@ const parseRelative = (offset, base) => {
20
20
  epoch.decDay();
21
21
  return epoch;
22
22
  default: {
23
- let idx = findIndex(EN_SHORT.days, offset);
23
+ let idx = __findIndex(EN_SHORT.days, offset);
24
24
  if (idx < 0) {
25
- idx = findIndex(EN_LONG.days, offset);
25
+ idx = __findIndex(EN_LONG.days, offset);
26
26
  }
27
27
  if (idx >= 0) {
28
28
  do {
@@ -34,16 +34,16 @@ const parseRelative = (offset, base) => {
34
34
  offset
35
35
  );
36
36
  return match ? relative(
37
- parseNum(match[1], !!match[7]),
38
- parsePeriod(match[2]),
37
+ __parseNum(match[1], !!match[7]),
38
+ __parsePeriod(match[2]),
39
39
  base
40
40
  ) : void 0;
41
41
  }
42
42
  }
43
43
  };
44
- const findIndex = (items, x) => items.findIndex((y) => y.toLowerCase() === x);
45
- const parseNum = (x, past) => (x === "next " || x === "a " || x === "an " ? 1 : Number(x)) * (past ? -1 : 1);
46
- const parsePeriod = (x) => {
44
+ const __findIndex = (items, x) => items.findIndex((y) => y.toLowerCase() === x);
45
+ const __parseNum = (x, past) => (x === "next " || x === "a " || x === "an " ? 1 : Number(x)) * (past ? -1 : 1);
46
+ const __parsePeriod = (x) => {
47
47
  x = x !== "s" && x !== "ms" && x.endsWith("s") ? x.substring(0, x.length - 1) : x;
48
48
  return {
49
49
  ms: "t",