@olenbetong/appframe-core 2.4.2 → 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/package.json CHANGED
@@ -1,52 +1,52 @@
1
1
  {
2
- "name": "@olenbetong/appframe-core",
3
- "version": "2.4.2",
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": "e8162eed9141f6e4ec7724cbbbeb3e22b00201f3"
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
- return toLocalISODateTime(date).substring(0, 10);
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
- export function toLocalISODateTime(date: Date) {
6
- let newDate = new Date(date);
7
- newDate.setUTCFullYear(date.getFullYear());
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
- return newDate.toISOString().replace("Z", "");
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
  }