@thi.ng/date 2.2.2 → 2.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/CHANGELOG.md +8 -1
- package/README.md +1 -1
- package/package.json +7 -7
- package/relative.d.ts +1 -1
- package/relative.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-
|
|
3
|
+
- **Last updated**: 2022-07-19T15:36:12Z
|
|
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.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/date@2.3.0) (2022-06-15)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- update parseRelative() ([0f7ecfc](https://github.com/thi-ng/umbrella/commit/0f7ecfc))
|
|
17
|
+
- add "mo" shorthand for months
|
|
18
|
+
|
|
12
19
|
## [2.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/date@2.2.0) (2022-05-18)
|
|
13
20
|
|
|
14
21
|
#### 🚀 Features
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/date",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Datetime types, relative dates, math, iterators, composable formatters, locales",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.3.
|
|
38
|
-
"@thi.ng/checks": "^3.2.
|
|
39
|
-
"@thi.ng/strings": "^3.3.
|
|
37
|
+
"@thi.ng/api": "^8.3.8",
|
|
38
|
+
"@thi.ng/checks": "^3.2.2",
|
|
39
|
+
"@thi.ng/strings": "^3.3.6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@microsoft/api-extractor": "^7.25.0",
|
|
43
|
-
"@thi.ng/testament": "^0.2.
|
|
43
|
+
"@thi.ng/testament": "^0.2.9",
|
|
44
44
|
"rimraf": "^3.0.2",
|
|
45
45
|
"tools": "^0.0.1",
|
|
46
46
|
"typedoc": "^0.22.17",
|
|
47
|
-
"typescript": "^4.7.
|
|
47
|
+
"typescript": "^4.7.4"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"datastructure",
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
"thi.ng": {
|
|
130
130
|
"year": 2020
|
|
131
131
|
},
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "108a6357b77d457912d30681d7cc5603ae995209\n"
|
|
133
133
|
}
|
package/relative.d.ts
CHANGED
package/relative.js
CHANGED
|
@@ -34,7 +34,7 @@ import { __idToPrecision, __precisionToID } from "./internal/precision.js";
|
|
|
34
34
|
* - `h` / `hour` / `hours`
|
|
35
35
|
* - `d` / `day` / `days`
|
|
36
36
|
* - `w` / `week` / `weeks`
|
|
37
|
-
* - `month` / `months`
|
|
37
|
+
* - `mo` / `month` / `months`
|
|
38
38
|
* - `q` / `quarter` / `quarters`
|
|
39
39
|
* - `y` / `year` / `years`
|
|
40
40
|
*
|
|
@@ -64,7 +64,7 @@ export const parseRelative = (offset, base) => {
|
|
|
64
64
|
} while (epoch.toDate().getDay() != idx);
|
|
65
65
|
return epoch;
|
|
66
66
|
}
|
|
67
|
-
const match = /^(an? |next |[-+]?\d+\s?)((ms|milli(?:(s?|seconds?)))|s(?:(ecs?|econds?))?|min(?:(s|utes?))?|h(?:ours?)?|d(?:ays?)?|w(?:eeks?)?|
|
|
67
|
+
const match = /^(an? |next |[-+]?\d+\s?)((ms|milli(?:(s?|seconds?)))|s(?:(ecs?|econds?))?|min(?:(s|utes?))?|h(?:ours?)?|d(?:ays?)?|w(?:eeks?)?|mo(?:nths?)?|q(?:uarters?)?|y(?:ears?)?)(\s+ago)?$/.exec(offset);
|
|
68
68
|
return match
|
|
69
69
|
? relative(parseNum(match[1], !!match[7]), parsePeriod(match[2]), base)
|
|
70
70
|
: undefined;
|
|
@@ -90,6 +90,7 @@ const parsePeriod = (x) => {
|
|
|
90
90
|
hour: "h",
|
|
91
91
|
day: "d",
|
|
92
92
|
week: "w",
|
|
93
|
+
mo: "M",
|
|
93
94
|
month: "M",
|
|
94
95
|
quarter: "q",
|
|
95
96
|
year: "y",
|