mol_time_all 1.1.9 → 1.1.13
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/.nojekyll +0 -0
- package/README.md +45 -0
- package/node.audit.js +1 -0
- package/node.d.ts +69 -40
- package/node.deps.json +1 -1
- package/node.esm.js +376 -275
- package/node.esm.js.map +1 -1
- package/node.js +377 -275
- package/node.js.map +1 -1
- package/node.test.js +2014 -601
- package/node.test.js.map +1 -1
- package/package.json +6 -3
- package/test.html +17 -0
- package/web.audit.js +1 -0
- package/web.css +1 -0
- package/web.css.map +1 -0
- package/web.d.ts +69 -40
- package/web.deps.json +1 -1
- package/web.esm.js +376 -272
- package/web.esm.js.map +1 -1
- package/web.js +377 -272
- package/web.js.map +1 -1
- package/web.test.js +703 -128
- package/web.test.js.map +1 -1
- package/web.test.html +0 -12
package/.nojekyll
ADDED
|
File without changes
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# $mol_time
|
|
2
|
+
|
|
3
|
+
Small, simple, powerfull, and fast TypeScript/JavaScript library for proper date/time/duration/interval arithmetic.
|
|
4
|
+
|
|
5
|
+
# Installation
|
|
6
|
+
|
|
7
|
+
## Direct
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<script src="https://unpkg.com/mol_time_all/web.js"></script>
|
|
11
|
+
<script>
|
|
12
|
+
alert( new $mol_time_moment() ) // alerts current time
|
|
13
|
+
</script>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## NPM
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm install mol_time_all
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### JavaScript
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
const Moment = require( 'mol_time_all' ).$mol_time_moment
|
|
26
|
+
console.log( new Moment().toString() ) // logs current time
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### TypeScript
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { $mol_time_moment as Moment } from 'mol_time_all'
|
|
33
|
+
console.log( new Moment().toString() ) // logs current time
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
# API
|
|
37
|
+
|
|
38
|
+
- [$mol_time_moment](moment)
|
|
39
|
+
- [$mol_time_duration](duration)
|
|
40
|
+
- [$mol_time_interval](interval)
|
|
41
|
+
|
|
42
|
+
# Articles
|
|
43
|
+
|
|
44
|
+
- [$mol_time — работаем с датами и временем правильно](https://habhub.hyoo.ru/#!author=nin-jin/repo=HabHub/article=28)
|
|
45
|
+
- [JavaScript нанобенчмарки и преждевременные тормоза](https://habhub.hyoo.ru/#!author=nin-jin/repo=HabHub/article=42)
|
package/node.audit.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.info("Audit passed")
|
package/node.d.ts
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
|
+
declare let _$_: {
|
|
2
|
+
new (): {};
|
|
3
|
+
} & typeof globalThis;
|
|
4
|
+
declare class $ extends _$_ {
|
|
5
|
+
}
|
|
1
6
|
declare namespace $ {
|
|
7
|
+
export type $ = typeof $$;
|
|
8
|
+
export class $$ extends $ {
|
|
9
|
+
}
|
|
10
|
+
namespace $$ {
|
|
11
|
+
type $$ = $;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
2
14
|
}
|
|
3
|
-
|
|
15
|
+
|
|
4
16
|
declare namespace $ {
|
|
5
17
|
class $mol_time_base {
|
|
6
|
-
static patterns: any
|
|
7
|
-
static formatter(pattern: string): any;
|
|
18
|
+
static patterns: Record<string, (arg: any) => string>;
|
|
19
|
+
static formatter(pattern: string): (arg: any) => string;
|
|
8
20
|
toString(pattern: string): string;
|
|
9
21
|
}
|
|
10
22
|
}
|
|
23
|
+
|
|
11
24
|
declare namespace $ {
|
|
12
25
|
type $mol_time_duration_config = number | string | {
|
|
13
26
|
year?: number;
|
|
@@ -38,12 +51,24 @@ declare namespace $ {
|
|
|
38
51
|
'#h': (duration: $mol_time_duration) => string;
|
|
39
52
|
'#m': (duration: $mol_time_duration) => string;
|
|
40
53
|
'#s': (duration: $mol_time_duration) => string;
|
|
41
|
-
'+hh': (duration: $mol_time_duration) => string;
|
|
42
|
-
'mm': (duration: $mol_time_duration) => string;
|
|
43
54
|
};
|
|
44
55
|
}
|
|
45
56
|
}
|
|
57
|
+
|
|
46
58
|
declare namespace $ {
|
|
59
|
+
function $mol_fail(error: any): never;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare namespace $ {
|
|
63
|
+
enum $mol_time_moment_weekdays {
|
|
64
|
+
monday = 0,
|
|
65
|
+
tuesday = 1,
|
|
66
|
+
wednesday = 2,
|
|
67
|
+
thursday = 3,
|
|
68
|
+
friday = 4,
|
|
69
|
+
saturday = 5,
|
|
70
|
+
sunday = 6
|
|
71
|
+
}
|
|
47
72
|
type $mol_time_moment_config = number | Date | string | {
|
|
48
73
|
year?: number;
|
|
49
74
|
month?: number;
|
|
@@ -55,57 +80,59 @@ declare namespace $ {
|
|
|
55
80
|
};
|
|
56
81
|
class $mol_time_moment extends $mol_time_base {
|
|
57
82
|
constructor(config?: $mol_time_moment_config);
|
|
58
|
-
readonly year: number;
|
|
59
|
-
readonly month: number;
|
|
60
|
-
readonly day: number;
|
|
61
|
-
readonly hour: number;
|
|
62
|
-
readonly minute: number;
|
|
63
|
-
readonly second: number;
|
|
64
|
-
readonly offset: $mol_time_duration;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
readonly year: number | undefined;
|
|
84
|
+
readonly month: number | undefined;
|
|
85
|
+
readonly day: number | undefined;
|
|
86
|
+
readonly hour: number | undefined;
|
|
87
|
+
readonly minute: number | undefined;
|
|
88
|
+
readonly second: number | undefined;
|
|
89
|
+
readonly offset: $mol_time_duration | undefined;
|
|
90
|
+
get weekday(): number;
|
|
91
|
+
_native: Date | undefined;
|
|
92
|
+
get native(): Date;
|
|
93
|
+
_normal: $mol_time_moment | undefined;
|
|
94
|
+
get normal(): $mol_time_moment;
|
|
70
95
|
merge(config: $mol_time_moment_config): $mol_time_moment;
|
|
71
96
|
shift(config: $mol_time_duration_config): $mol_time_moment;
|
|
97
|
+
mask(config: $mol_time_moment_config): $mol_time_moment;
|
|
72
98
|
toOffset(config: $mol_time_duration_config): $mol_time_moment;
|
|
73
99
|
valueOf(): number;
|
|
74
100
|
toJSON(): string;
|
|
75
101
|
toString(pattern?: string): string;
|
|
76
102
|
static patterns: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
103
|
+
YYYY: (moment: $mol_time_moment) => string;
|
|
104
|
+
AD: (moment: $mol_time_moment) => string;
|
|
105
|
+
YY: (moment: $mol_time_moment) => string;
|
|
106
|
+
Month: (moment: $mol_time_moment) => string;
|
|
81
107
|
'DD Month': (moment: $mol_time_moment) => string;
|
|
82
108
|
'D Month': (moment: $mol_time_moment) => string;
|
|
83
|
-
|
|
109
|
+
Mon: (moment: $mol_time_moment) => string;
|
|
84
110
|
'DD Mon': (moment: $mol_time_moment) => string;
|
|
85
111
|
'D Mon': (moment: $mol_time_moment) => string;
|
|
86
112
|
'-MM': (moment: $mol_time_moment) => string;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
113
|
+
MM: (moment: $mol_time_moment) => string;
|
|
114
|
+
M: (moment: $mol_time_moment) => string;
|
|
115
|
+
WeekDay: (moment: $mol_time_moment) => string;
|
|
116
|
+
WD: (moment: $mol_time_moment) => string;
|
|
91
117
|
'-DD': (moment: $mol_time_moment) => string;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
118
|
+
DD: (moment: $mol_time_moment) => string;
|
|
119
|
+
D: (moment: $mol_time_moment) => string;
|
|
120
|
+
Thh: (moment: $mol_time_moment) => string;
|
|
121
|
+
hh: (moment: $mol_time_moment) => string;
|
|
122
|
+
h: (moment: $mol_time_moment) => string;
|
|
97
123
|
':mm': (moment: $mol_time_moment) => string;
|
|
98
|
-
|
|
99
|
-
|
|
124
|
+
mm: (moment: $mol_time_moment) => string;
|
|
125
|
+
m: (moment: $mol_time_moment) => string;
|
|
100
126
|
':ss': (moment: $mol_time_moment) => string;
|
|
101
|
-
|
|
102
|
-
|
|
127
|
+
ss: (moment: $mol_time_moment) => string;
|
|
128
|
+
s: (moment: $mol_time_moment) => string;
|
|
103
129
|
'.sss': (moment: $mol_time_moment) => string;
|
|
104
|
-
|
|
105
|
-
|
|
130
|
+
sss: (moment: $mol_time_moment) => string;
|
|
131
|
+
Z: (moment: $mol_time_moment) => string;
|
|
106
132
|
};
|
|
107
133
|
}
|
|
108
134
|
}
|
|
135
|
+
|
|
109
136
|
declare namespace $ {
|
|
110
137
|
type $mol_time_interval_config = string | {
|
|
111
138
|
start?: $mol_time_moment_config;
|
|
@@ -115,12 +142,14 @@ declare namespace $ {
|
|
|
115
142
|
class $mol_time_interval extends $mol_time_base {
|
|
116
143
|
constructor(config: $mol_time_interval_config);
|
|
117
144
|
private _start;
|
|
118
|
-
|
|
145
|
+
get start(): $mol_time_moment;
|
|
119
146
|
private _end;
|
|
120
|
-
|
|
147
|
+
get end(): $mol_time_moment;
|
|
121
148
|
private _duration;
|
|
122
|
-
|
|
149
|
+
get duration(): $mol_time_duration;
|
|
123
150
|
toJSON(): string;
|
|
124
151
|
toString(): string;
|
|
125
152
|
}
|
|
126
153
|
}
|
|
154
|
+
|
|
155
|
+
export = $;
|
package/node.deps.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":["mol/CNAME","mol/
|
|
1
|
+
{"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/time/readme.md","mol/time/base/base.ts","mol/time/duration/duration.ts","mol/time/duration/readme.md","mol/fail/fail.ts","mol/time/moment/moment.ts","mol/time/moment/readme.md","mol/time/interval/interval.ts","mol/time/interval/readme.md","mol/time/all/all.meta.tree","mol/time/all/package.json"],"mods":{},"deps_in":{"mol/time":{"mol/time/all":-9007199254740991,"mol/time/moment":-9007199254740991,"mol/time/duration":-9007199254740991,"mol/time/base":-9007199254740991,"mol/time/interval":-9007199254740991},"mol":{"mol/time":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/time/moment":{"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/duration":{"mol/time/moment":-2,"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/base":{"mol/time/duration":-1,"mol/time/moment":-1,"mol/time/interval":-1},"mol/fail":{"mol/time/moment":-2},"mol/time/interval":{"mol/time/all":-9000}},"deps_out":{"mol/time/all":{"mol/time":-9007199254740991,"mol/time/moment":-9000,"mol/time/duration":-9000,"mol/time/interval":-9000},"mol/time":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/time/moment":{"mol/time":-9007199254740991,"mol/time/duration":-2,"mol/fail":-2,"mol/time/base":-1},"mol/time/duration":{"mol/time":-9007199254740991,"mol/time/base":-1},"mol/time/base":{"mol/time":-9007199254740991},"mol/fail":{"mol":-9007199254740991},"mol/time/interval":{"mol/time":-9007199254740991,"mol/time/moment":-2,"mol/time/duration":-2,"mol/time/base":-1}},"sloc":{"LICENSE":113,"md":712,"tree":34,"js":10,"ts":577,"json":89,"lock":933,"CNAME":1,"html":1},"deps":{"mol/time/all":{"..":-9007199254740991,"/mol/time/moment":-9000,"/mol/time/duration":-9000,"/mol/time/interval":-9000},"mol/time":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/time/moment":{"..":-9007199254740991,"/mol/time/moment/weekdays":-1,"/mol/time/moment/config":-1,"/mol/time/duration/config":-2,"/mol/fail":-2,"/mol/time/moment":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/time/moment/patterns":-4},"mol/time/duration":{"..":-9007199254740991,"/mol/time/duration/config":-1,"/mol/time/duration":-1,"/mol/time/base":-1},"mol/time/base":{"..":-9007199254740991,"/mol/time/base":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/time/interval":{"..":-9007199254740991,"/mol/time/interval/config":-1,"/mol/time/moment/config":-2,"/mol/time/duration/config":-2,"/mol/time/interval":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/time/moment":-2}}}
|