@olenbetong/appframe-core 2.4.1 → 2.4.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.
- package/dist/esm/af.common.js +9 -10
- package/dist/esm/af.common.legacy.js +9 -10
- package/dist/esm/af.common.legacy.min.js +1 -1
- package/dist/esm/af.common.legacy.min.js.map +3 -3
- package/dist/esm/af.common.min.js +1 -1
- package/dist/esm/af.common.min.js.map +3 -3
- package/dist/iife/af.common.js +9 -10
- package/dist/iife/af.common.legacy.js +9 -10
- package/dist/iife/af.common.legacy.min.js +1 -1
- package/dist/iife/af.common.legacy.min.js.map +3 -3
- package/dist/iife/af.common.min.js +1 -1
- package/dist/iife/af.common.min.js.map +3 -3
- package/es/date.d.ts +2 -0
- package/es/date.js +7 -8
- package/es/index.js +1 -1
- package/es/localize.js +1 -1
- package/package.json +50 -50
- package/src/date.ts +15 -10
- package/src/localize.ts +1 -1
package/es/date.d.ts
CHANGED
package/es/date.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export function toLocalISODate(date) {
|
|
2
|
-
return toLocalISODateTime(date).substring(0, 10);
|
|
2
|
+
return date ? toLocalISODateTime(date).substring(0, 10) : null;
|
|
3
|
+
}
|
|
4
|
+
function pad(num) {
|
|
5
|
+
return String(num).padStart(2, "0");
|
|
3
6
|
}
|
|
4
7
|
export function toLocalISODateTime(date) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
newDate.setUTCDate(date.getDate());
|
|
9
|
-
newDate.setUTCHours(date.getHours());
|
|
10
|
-
newDate.setUTCMinutes(date.getMinutes());
|
|
11
|
-
return newDate.toISOString().replace("Z", "");
|
|
8
|
+
return date
|
|
9
|
+
? `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}.${pad(date.getMilliseconds())}`
|
|
10
|
+
: null;
|
|
12
11
|
}
|
package/es/index.js
CHANGED
package/es/localize.js
CHANGED
|
@@ -14,7 +14,7 @@ import { invariant } from "./invariant.js";
|
|
|
14
14
|
* @returns Translated string
|
|
15
15
|
*/
|
|
16
16
|
export function localize(stringParts, ...args) {
|
|
17
|
-
invariant(
|
|
17
|
+
invariant(Array.isArray(stringParts) && stringParts.length === args.length + 1, "Method 'localize' must be used as a tag function");
|
|
18
18
|
let stringToLocalize = stringParts.map((s, i) => (i === stringParts.length - 1 ? s : `${s}\$${i}`)).join("");
|
|
19
19
|
let localized = getLocalizedString(stringToLocalize);
|
|
20
20
|
args.forEach((arg, index) => {
|
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
2
|
+
"name": "@olenbetong/appframe-core",
|
|
3
|
+
"version": "2.4.3",
|
|
4
|
+
"description": "Javascript libraries to utilize the Appframe framework",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"/src/errorHandler.ts"
|
|
8
|
+
],
|
|
9
|
+
"main": "./es/index.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"default": "./es/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"types": "./es/index.d.ts",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"prepack": "npm run build",
|
|
18
|
+
"build": "npm run build:esbuild && npm run build:tsc",
|
|
19
|
+
"build:esbuild": "node --loader ts-node/esm.mjs ../../shared/esbuild.ts",
|
|
20
|
+
"build:tsc": " rm -rf ./es && tsc && node ./scripts/replace-version.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"es",
|
|
25
|
+
"src"
|
|
26
|
+
],
|
|
27
|
+
"author": "Bjørnar Vister Hansen <bvh@olenbetong.no>",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/olenbetong/ui-kit.git"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"buildConfig": {
|
|
34
|
+
"entries": [
|
|
35
|
+
{
|
|
36
|
+
"libraryName": "af.common"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"libraryName": "af.common",
|
|
40
|
+
"outfile": "af.common.legacy",
|
|
41
|
+
"target": "safari11"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"mitt": "^3.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"chalk": "^5.1.2"
|
|
50
|
+
},
|
|
51
|
+
"gitHead": "1d17062e6d3a5bee1264d25572ec08ea2635f1ca"
|
|
52
52
|
}
|
package/src/date.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
export function toLocalISODate(date: Date)
|
|
2
|
-
|
|
1
|
+
export function toLocalISODate(date: Date): string;
|
|
2
|
+
export function toLocalISODate(date: null): null;
|
|
3
|
+
export function toLocalISODate(date: Date | null): string | null {
|
|
4
|
+
return date ? toLocalISODateTime(date).substring(0, 10) : null;
|
|
3
5
|
}
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
newDate.setUTCMonth(date.getMonth());
|
|
9
|
-
newDate.setUTCDate(date.getDate());
|
|
10
|
-
newDate.setUTCHours(date.getHours());
|
|
11
|
-
newDate.setUTCMinutes(date.getMinutes());
|
|
7
|
+
function pad(num: number) {
|
|
8
|
+
return String(num).padStart(2, "0");
|
|
9
|
+
}
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
export function toLocalISODateTime(date: Date): string;
|
|
12
|
+
export function toLocalISODateTime(date: null): null;
|
|
13
|
+
export function toLocalISODateTime(date: Date | null): string | null {
|
|
14
|
+
return date
|
|
15
|
+
? `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(
|
|
16
|
+
date.getMinutes()
|
|
17
|
+
)}:${pad(date.getSeconds())}.${pad(date.getMilliseconds())}`
|
|
18
|
+
: null;
|
|
14
19
|
}
|
package/src/localize.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { invariant } from "./invariant.js";
|
|
|
16
16
|
*/
|
|
17
17
|
export function localize(stringParts: TemplateStringsArray, ...args: any[]): string {
|
|
18
18
|
invariant(
|
|
19
|
-
|
|
19
|
+
Array.isArray(stringParts) && stringParts.length === args.length + 1,
|
|
20
20
|
"Method 'localize' must be used as a tag function"
|
|
21
21
|
);
|
|
22
22
|
|