@kizmann/pico-js 2.0.7 → 2.0.9
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/pico-js.browser.js +1 -1
- package/dist/pico-js.browser.js.map +1 -1
- package/dist/pico-js.esm.js +1 -1
- package/dist/pico-js.esm.js.map +1 -1
- package/package.json +4 -6
- package/src/dom/{DomAttribute.js → DomAttribute.ts} +40 -63
- package/src/dom/{DomBuilder.js → DomBuilder.ts} +27 -44
- package/src/dom/{DomEvent.js → DomEvent.ts} +101 -76
- package/src/dom/{DomFinder.js → DomFinder.ts} +103 -139
- package/src/dom/DomForm.ts +38 -0
- package/src/dom/{DomGlobal.js → DomGlobal.ts} +34 -51
- package/src/dom/{DomInview.js → DomInview.ts} +37 -57
- package/src/dom/DomMeta.ts +48 -0
- package/src/dom/DomObserver.ts +17 -0
- package/src/dom/{DomPopover.js → DomPopover.ts} +20 -39
- package/src/dom/{DomRectangle.js → DomRectangle.ts} +70 -87
- package/src/format/{FormatFile.js → FormatFile.ts} +12 -23
- package/src/format/{FormatOption.js → FormatOption.ts} +15 -24
- package/src/format/{FormatParam.js → FormatParam.ts} +14 -25
- package/src/format/{FormatParser.js → FormatParser.ts} +29 -39
- package/src/format/{FormatUrl.js → FormatUrl.ts} +9 -21
- package/src/index.browser.ts +32 -0
- package/src/index.esm.ts +64 -0
- package/src/now/{NowDefault.js → NowDefault.ts} +86 -121
- package/src/now/{NowFormat.js → NowFormat.ts} +23 -28
- package/src/now/{NowGrid.js → NowGrid.ts} +41 -58
- package/src/now/{NowHuman.js → NowHuman.ts} +18 -27
- package/src/now/{NowMatch.js → NowMatch.ts} +22 -28
- package/src/now/{NowRange.js → NowRange.ts} +13 -22
- package/src/now/{NowWalker.js → NowWalker.ts} +65 -71
- package/src/tool/{scope.js → scope.ts} +41 -11
- package/src/utils/{Array.js → Array.ts} +187 -152
- package/src/utils/{Cookie.js → Cookie.ts} +15 -12
- package/src/utils/{Data.js → Data.ts} +17 -17
- package/src/utils/Dom.ts +204 -0
- package/src/utils/Format.ts +48 -0
- package/src/utils/{Hash.js → Hash.ts} +20 -20
- package/src/utils/{Locale.js → Locale.ts} +21 -21
- package/src/utils/{Mixed.js → Mixed.ts} +104 -61
- package/src/utils/{Now.js → Now.ts} +68 -69
- package/src/utils/{Number.js → Number.ts} +34 -36
- package/src/utils/{Object.js → Object.ts} +68 -122
- package/src/utils/{Route.js → Route.ts} +11 -9
- package/src/utils/{Runner.js → Runner.ts} +89 -77
- package/src/utils/{Signal.js → Signal.ts} +35 -22
- package/src/utils/{String.js → String.ts} +79 -69
- package/src/wip/{Element.js → Element.ts} +2 -2
- package/src/wip/{Map.js → Map.ts} +1 -1
- package/types/dom/DomAttribute.d.ts +16 -27
- package/types/dom/DomBuilder.d.ts +6 -9
- package/types/dom/DomEvent.d.ts +19 -24
- package/types/dom/DomFinder.d.ts +38 -61
- package/types/dom/DomForm.d.ts +7 -10
- package/types/dom/DomGlobal.d.ts +8 -15
- package/types/dom/DomInview.d.ts +9 -19
- package/types/dom/DomMeta.d.ts +9 -16
- package/types/dom/DomObserver.d.ts +4 -8
- package/types/dom/DomPopover.d.ts +8 -11
- package/types/dom/DomRectangle.d.ts +21 -35
- package/types/format/FormatFile.d.ts +5 -8
- package/types/format/FormatOption.d.ts +6 -8
- package/types/format/FormatParam.d.ts +6 -9
- package/types/format/FormatParser.d.ts +10 -18
- package/types/format/FormatUrl.d.ts +5 -8
- package/types/index.esm.d.ts +25 -37
- package/types/now/NowDefault.d.ts +30 -99
- package/types/now/NowFormat.d.ts +8 -21
- package/types/now/NowGrid.d.ts +24 -46
- package/types/now/NowHuman.d.ts +10 -11
- package/types/now/NowMatch.d.ts +6 -4
- package/types/now/NowRange.d.ts +5 -8
- package/types/now/NowWalker.d.ts +6 -4
- package/types/tool/scope.d.ts +11 -3
- package/types/utils/Array.d.ts +83 -101
- package/types/utils/Cookie.d.ts +11 -8
- package/types/utils/Data.d.ts +7 -7
- package/types/utils/Dom.d.ts +63 -96
- package/types/utils/Format.d.ts +15 -28
- package/types/utils/Hash.d.ts +21 -21
- package/types/utils/Locale.d.ts +9 -9
- package/types/utils/Mixed.d.ts +19 -32
- package/types/utils/Now.d.ts +51 -56
- package/types/utils/Number.d.ts +9 -20
- package/types/utils/Object.d.ts +21 -36
- package/types/utils/Route.d.ts +5 -2
- package/types/utils/Runner.d.ts +45 -38
- package/types/utils/Signal.d.ts +16 -16
- package/types/utils/String.d.ts +40 -76
- package/src/dom/DomForm.js +0 -59
- package/src/dom/DomMeta.js +0 -68
- package/src/dom/DomObserver.js +0 -38
- package/src/index.browser.js +0 -36
- package/src/index.esm.js +0 -80
- package/src/utils/Dom.js +0 -214
- package/src/utils/Format.js +0 -62
- package/types/wip/Element.d.ts +0 -119
- package/types/wip/Map.d.ts +0 -254
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { Arr
|
|
2
|
-
import {
|
|
1
|
+
import { Arr } from "../index.esm.ts";
|
|
2
|
+
import { PicoNowInterface } from "../utils/Now.ts";
|
|
3
|
+
import PicoNowWalker from "./NowWalker.js";
|
|
4
|
+
|
|
5
|
+
export interface PicoNowGrid extends PicoNowInterface,
|
|
6
|
+
PicoNowWalker
|
|
7
|
+
{
|
|
8
|
+
//
|
|
9
|
+
}
|
|
3
10
|
|
|
4
11
|
/**
|
|
5
12
|
* @memberof PicoNow
|
|
6
|
-
* @extends {PicoNow}
|
|
7
13
|
*/
|
|
8
|
-
export class
|
|
14
|
+
export class PicoNowGrid
|
|
9
15
|
{
|
|
10
16
|
/**
|
|
11
17
|
* Get grid of dates by scope
|
|
@@ -13,9 +19,9 @@ export class PicoNowGridInstance
|
|
|
13
19
|
* @example Now.grid("month") // => [Now, Now, ...]
|
|
14
20
|
*
|
|
15
21
|
* @param {string} [scope] Grid scope
|
|
16
|
-
* @returns {Array<
|
|
22
|
+
* @returns {Array<PicoNowInterface>} Array of dates
|
|
17
23
|
*/
|
|
18
|
-
grid(scope = 'day')
|
|
24
|
+
grid(scope : string = 'day') : Array<PicoNowInterface>
|
|
19
25
|
{
|
|
20
26
|
if ( /^seconds?$/i.test(scope) ) {
|
|
21
27
|
return this.getSecondsGrid();
|
|
@@ -58,9 +64,9 @@ export class PicoNowGridInstance
|
|
|
58
64
|
* @example Now.getSecondsGrid(10)
|
|
59
65
|
*
|
|
60
66
|
* @param {number} [interval] Step interval
|
|
61
|
-
* @returns {Array<
|
|
67
|
+
* @returns {Array<PicoNowInterface>} Array of dates
|
|
62
68
|
*/
|
|
63
|
-
getSecondsGrid(interval = 1)
|
|
69
|
+
getSecondsGrid(interval : number = 1) : Array<PicoNowInterface>
|
|
64
70
|
{
|
|
65
71
|
if ( interval == null ) {
|
|
66
72
|
interval = 1;
|
|
@@ -77,9 +83,9 @@ export class PicoNowGridInstance
|
|
|
77
83
|
* @example Now.getMinutesGrid(10)
|
|
78
84
|
*
|
|
79
85
|
* @param {number} [interval] Step interval
|
|
80
|
-
* @returns {Array<
|
|
86
|
+
* @returns {Array<PicoNowInterface>} Array of dates
|
|
81
87
|
*/
|
|
82
|
-
getMinutesGrid(interval = 1)
|
|
88
|
+
getMinutesGrid(interval : number = 1) : Array<PicoNowInterface>
|
|
83
89
|
{
|
|
84
90
|
if ( interval == null ) {
|
|
85
91
|
interval = 1;
|
|
@@ -96,9 +102,9 @@ export class PicoNowGridInstance
|
|
|
96
102
|
* @example Now.getHoursGrid(2)
|
|
97
103
|
*
|
|
98
104
|
* @param {number} [interval] Step interval
|
|
99
|
-
* @returns {Array<
|
|
105
|
+
* @returns {Array<PicoNowInterface>} Array of dates
|
|
100
106
|
*/
|
|
101
|
-
getHoursGrid(interval = 1)
|
|
107
|
+
getHoursGrid(interval : number = 1) : Array<PicoNowInterface>
|
|
102
108
|
{
|
|
103
109
|
if ( interval == null ) {
|
|
104
110
|
interval = 1;
|
|
@@ -114,9 +120,9 @@ export class PicoNowGridInstance
|
|
|
114
120
|
*
|
|
115
121
|
* @example Now.getDaysGrid()
|
|
116
122
|
*
|
|
117
|
-
* @returns {Array<
|
|
123
|
+
* @returns {Array<PicoNowInterface>} Array of dates
|
|
118
124
|
*/
|
|
119
|
-
getDaysGrid()
|
|
125
|
+
getDaysGrid() : Array<PicoNowInterface>
|
|
120
126
|
{
|
|
121
127
|
let dates = [
|
|
122
128
|
this.first('date').first('day'), this.last('date').last('day')
|
|
@@ -130,9 +136,9 @@ export class PicoNowGridInstance
|
|
|
130
136
|
*
|
|
131
137
|
* @example Now.getDatesGrid()
|
|
132
138
|
*
|
|
133
|
-
* @returns {Array<
|
|
139
|
+
* @returns {Array<PicoNowInterface>} Array of dates
|
|
134
140
|
*/
|
|
135
|
-
getDatesGrid()
|
|
141
|
+
getDatesGrid() : Array<PicoNowInterface>
|
|
136
142
|
{
|
|
137
143
|
let dates = [
|
|
138
144
|
this.first('date'), this.last('date')
|
|
@@ -146,9 +152,9 @@ export class PicoNowGridInstance
|
|
|
146
152
|
*
|
|
147
153
|
* @example Now.getMonthsGrid()
|
|
148
154
|
*
|
|
149
|
-
* @returns {Array<
|
|
155
|
+
* @returns {Array<PicoNowInterface>} Array of dates
|
|
150
156
|
*/
|
|
151
|
-
getMonthsGrid()
|
|
157
|
+
getMonthsGrid() : Array<PicoNowInterface>
|
|
152
158
|
{
|
|
153
159
|
let dates = [
|
|
154
160
|
this.first('month'), this.last('month')
|
|
@@ -162,9 +168,9 @@ export class PicoNowGridInstance
|
|
|
162
168
|
*
|
|
163
169
|
* @example Now.getYearsGrid()
|
|
164
170
|
*
|
|
165
|
-
* @returns {Array<
|
|
171
|
+
* @returns {Array<PicoNowInterface>} Array of dates
|
|
166
172
|
*/
|
|
167
|
-
getYearsGrid()
|
|
173
|
+
getYearsGrid() : Array<PicoNowInterface>
|
|
168
174
|
{
|
|
169
175
|
let dates = [
|
|
170
176
|
this.first('year'), this.clone().last('year')
|
|
@@ -178,9 +184,9 @@ export class PicoNowGridInstance
|
|
|
178
184
|
*
|
|
179
185
|
* @example Now.getDecadesGrid()
|
|
180
186
|
*
|
|
181
|
-
* @returns {Array<
|
|
187
|
+
* @returns {Array<PicoNowInterface>} Array of dates
|
|
182
188
|
*/
|
|
183
|
-
getDecadesGrid()
|
|
189
|
+
getDecadesGrid() : Array<PicoNowInterface>
|
|
184
190
|
{
|
|
185
191
|
let dates = [
|
|
186
192
|
this.first('decade'), this.clone().last('decade')
|
|
@@ -191,63 +197,40 @@ export class PicoNowGridInstance
|
|
|
191
197
|
|
|
192
198
|
}
|
|
193
199
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
*/
|
|
197
|
-
PicoNowGridInstance.prototype.getYears = function () {
|
|
200
|
+
// @ts-ignore
|
|
201
|
+
PicoNowGrid.prototype.getYears = function () {
|
|
198
202
|
console.warn('Now.getYears() is deprecated, use Now.grid(\'years\') instead.');
|
|
199
203
|
return this.grid('years');
|
|
200
204
|
}
|
|
201
205
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
*/
|
|
205
|
-
PicoNowGridInstance.prototype.getMonths = function () {
|
|
206
|
+
// @ts-ignore
|
|
207
|
+
PicoNowGrid.prototype.getMonths = function () {
|
|
206
208
|
console.warn('Now.getMonths() is deprecated, use Now.grid(\'months\') instead.');
|
|
207
209
|
return this.grid('months');
|
|
208
210
|
}
|
|
209
211
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
*/
|
|
213
|
-
PicoNowGridInstance.prototype.getDates = function () {
|
|
212
|
+
// @ts-ignore
|
|
213
|
+
PicoNowGrid.prototype.getDates = function () {
|
|
214
214
|
console.warn('Now.getDates() is deprecated, use Now.grid(\'dates\') instead.');
|
|
215
215
|
return this.grid('dates');
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
*/
|
|
221
|
-
PicoNowGridInstance.prototype.getHours = function () {
|
|
218
|
+
// @ts-ignore
|
|
219
|
+
PicoNowGrid.prototype.getHours = function () {
|
|
222
220
|
console.warn('Now.getHours() is deprecated, use Now.grid(\'hours\') instead.');
|
|
223
221
|
return this.grid('hours');
|
|
224
222
|
}
|
|
225
223
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
*/
|
|
229
|
-
PicoNowGridInstance.prototype.getMinutes = function () {
|
|
224
|
+
// @ts-ignore
|
|
225
|
+
PicoNowGrid.prototype.getMinutes = function () {
|
|
230
226
|
console.warn('Now.getMinutes() is deprecated, use Now.grid(\'minutes\') instead.');
|
|
231
227
|
return this.grid('minutes');
|
|
232
228
|
}
|
|
233
229
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
*/
|
|
237
|
-
PicoNowGridInstance.prototype.getSeconds = function () {
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
PicoNowGrid.prototype.getSeconds = function () {
|
|
238
232
|
console.warn('Now.getSeconds() is deprecated, use Now.grid(\'seconds\') instead.');
|
|
239
233
|
return this.grid('seconds');
|
|
240
234
|
}
|
|
241
235
|
|
|
242
|
-
|
|
243
|
-
* @param {typeof PicoNow} self
|
|
244
|
-
* @returns {typeof PicoNow}
|
|
245
|
-
*/
|
|
246
|
-
export const PicoNowGridPlugin = function (self) {
|
|
247
|
-
|
|
248
|
-
Obj.each(Mix.proto(PicoNowGridInstance), (fn, id) => {
|
|
249
|
-
self.prototype[id] = fn;
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
return self;
|
|
253
|
-
}
|
|
236
|
+
export default PicoNowGrid;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Locale } from "../index.esm.ts";
|
|
2
|
+
import { PicoNowInterface } from "../utils/Now.ts";
|
|
3
|
+
import PicoNowDefault from "./NowDefault.js";
|
|
3
4
|
|
|
4
|
-
export const NOW_HUMAN_DAYS = [
|
|
5
|
+
export const NOW_HUMAN_DAYS : string[] = [
|
|
5
6
|
'Sunday',
|
|
6
7
|
'Monday',
|
|
7
8
|
'Tuesday',
|
|
@@ -11,7 +12,7 @@ export const NOW_HUMAN_DAYS = [
|
|
|
11
12
|
'Saturday'
|
|
12
13
|
];
|
|
13
14
|
|
|
14
|
-
export const NOW_HUMAN_MONTHS = [
|
|
15
|
+
export const NOW_HUMAN_MONTHS : string[] = [
|
|
15
16
|
'January',
|
|
16
17
|
'February',
|
|
17
18
|
'March',
|
|
@@ -26,11 +27,12 @@ export const NOW_HUMAN_MONTHS = [
|
|
|
26
27
|
'December'
|
|
27
28
|
];
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
export interface PicoNowHuman extends PicoNowInterface, PicoNowDefault
|
|
31
|
+
{
|
|
32
|
+
//
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class PicoNowHuman
|
|
34
36
|
{
|
|
35
37
|
/**
|
|
36
38
|
* Get human readable value
|
|
@@ -39,9 +41,9 @@ export class PicoNowHumanInstance
|
|
|
39
41
|
*
|
|
40
42
|
* @param {string} [scope] Value scope
|
|
41
43
|
* @param {number} [substr] Substring length
|
|
42
|
-
* @returns {
|
|
44
|
+
* @returns {any} Human value
|
|
43
45
|
*/
|
|
44
|
-
human(scope = 'day', substr = null)
|
|
46
|
+
human(scope : string = 'day', substr : number = null) : any
|
|
45
47
|
{
|
|
46
48
|
if ( /^days?$/i.test(scope) ) {
|
|
47
49
|
return this.getHumanDay(substr);
|
|
@@ -62,11 +64,11 @@ export class PicoNowHumanInstance
|
|
|
62
64
|
* @param {number} [substr] Substring length
|
|
63
65
|
* @returns {string} Day name
|
|
64
66
|
*/
|
|
65
|
-
getHumanDay(substr = null)
|
|
67
|
+
getHumanDay(substr : number = null) : string
|
|
66
68
|
{
|
|
67
69
|
let day = this.day() - 1;
|
|
68
70
|
|
|
69
|
-
if ( !
|
|
71
|
+
if ( !NOW_HUMAN_DAYS[day] ) {
|
|
70
72
|
throw new Error(`Invalid day number "${day}".`);
|
|
71
73
|
}
|
|
72
74
|
|
|
@@ -87,11 +89,11 @@ export class PicoNowHumanInstance
|
|
|
87
89
|
* @param {number} [substr] Substring length
|
|
88
90
|
* @returns {string} Month name
|
|
89
91
|
*/
|
|
90
|
-
getHumanMonth(substr = null)
|
|
92
|
+
getHumanMonth(substr : number = null) : string
|
|
91
93
|
{
|
|
92
94
|
let month = this.day() - 1;
|
|
93
95
|
|
|
94
|
-
if ( !
|
|
96
|
+
if ( !NOW_HUMAN_MONTHS[month] ) {
|
|
95
97
|
throw new Error(`Invalid month number "${month}".`);
|
|
96
98
|
}
|
|
97
99
|
|
|
@@ -106,15 +108,4 @@ export class PicoNowHumanInstance
|
|
|
106
108
|
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
* @param {typeof PicoNow} self
|
|
111
|
-
* @returns {typeof PicoNow}
|
|
112
|
-
*/
|
|
113
|
-
export const PicoNowHumanPlugin = function (self) {
|
|
114
|
-
|
|
115
|
-
Obj.each(Mix.proto(PicoNowHumanInstance), (fn, id) => {
|
|
116
|
-
self.prototype[id] = fn;
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
return self;
|
|
120
|
-
}
|
|
111
|
+
export default PicoNowHuman;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import { Mix, Now, Obj } from "../index.esm.
|
|
2
|
-
import { PicoNow } from "../utils/Now.
|
|
1
|
+
import { Mix, Now, Obj } from "../index.esm.ts";
|
|
2
|
+
import { PicoNow, PicoNowInterface } from "../utils/Now.ts";
|
|
3
|
+
import PicoNowFormat from "./NowFormat.js";
|
|
4
|
+
|
|
5
|
+
export interface PicoNowMatch extends PicoNowInterface,
|
|
6
|
+
PicoNowFormat
|
|
7
|
+
{
|
|
8
|
+
//
|
|
9
|
+
}
|
|
3
10
|
|
|
4
11
|
/**
|
|
5
12
|
* @memberof PicoNow
|
|
6
|
-
* @extends {PicoNow}
|
|
7
13
|
*/
|
|
8
|
-
export class
|
|
14
|
+
export class PicoNowMatch
|
|
9
15
|
{
|
|
10
|
-
|
|
11
16
|
/**
|
|
12
17
|
* Check if date is before value
|
|
13
18
|
*
|
|
@@ -17,7 +22,7 @@ export class PicoNowMatchInstance
|
|
|
17
22
|
* @param {string} [format] Compare format
|
|
18
23
|
* @returns {boolean} True if before
|
|
19
24
|
*/
|
|
20
|
-
before(value = null, format = 'x')
|
|
25
|
+
before(value : any = null, format : string = 'x') : boolean
|
|
21
26
|
{
|
|
22
27
|
return this.code(format) < Now.make(value).code(format);
|
|
23
28
|
}
|
|
@@ -31,7 +36,7 @@ export class PicoNowMatchInstance
|
|
|
31
36
|
* @param {string} [format] Compare format
|
|
32
37
|
* @returns {boolean} True if before
|
|
33
38
|
*/
|
|
34
|
-
beforeDate(value = null, format = 'YYYYMMDD')
|
|
39
|
+
beforeDate(value : any = null, format : string = 'YYYYMMDD') : boolean
|
|
35
40
|
{
|
|
36
41
|
return this.before(value, format);
|
|
37
42
|
}
|
|
@@ -45,7 +50,7 @@ export class PicoNowMatchInstance
|
|
|
45
50
|
* @param {string} [format] Compare format
|
|
46
51
|
* @returns {boolean} True if before
|
|
47
52
|
*/
|
|
48
|
-
beforeTime(value = null, format = 'HHmmss')
|
|
53
|
+
beforeTime(value : any = null, format : string = 'HHmmss') : boolean
|
|
49
54
|
{
|
|
50
55
|
return this.before(value, format);
|
|
51
56
|
}
|
|
@@ -59,7 +64,7 @@ export class PicoNowMatchInstance
|
|
|
59
64
|
* @param {string} [format] Compare format
|
|
60
65
|
* @returns {boolean} True if after
|
|
61
66
|
*/
|
|
62
|
-
after(value = null, format = 'x')
|
|
67
|
+
after(value : any = null, format : string = 'x') : boolean
|
|
63
68
|
{
|
|
64
69
|
return this.code(format) > Now.make(value).code(format);
|
|
65
70
|
}
|
|
@@ -73,7 +78,7 @@ export class PicoNowMatchInstance
|
|
|
73
78
|
* @param {string} [format] Compare format
|
|
74
79
|
* @returns {boolean} True if after
|
|
75
80
|
*/
|
|
76
|
-
afterDate(value = null, format = 'YYYYMMDD')
|
|
81
|
+
afterDate(value : any = null, format : string = 'YYYYMMDD') : boolean
|
|
77
82
|
{
|
|
78
83
|
return this.after(value, format);
|
|
79
84
|
}
|
|
@@ -87,7 +92,7 @@ export class PicoNowMatchInstance
|
|
|
87
92
|
* @param {string} [format] Compare format
|
|
88
93
|
* @returns {boolean} True if after
|
|
89
94
|
*/
|
|
90
|
-
afterTime(value = null, format = 'HHmmss')
|
|
95
|
+
afterTime(value : any = null, format : string = 'HHmmss') : boolean
|
|
91
96
|
{
|
|
92
97
|
return this.after(value, format);
|
|
93
98
|
}
|
|
@@ -101,9 +106,9 @@ export class PicoNowMatchInstance
|
|
|
101
106
|
* @param {string} [format] Compare format
|
|
102
107
|
* @returns {boolean} True if equal
|
|
103
108
|
*/
|
|
104
|
-
equal(value = null, format = 'x')
|
|
109
|
+
equal(value : any = null, format : string = 'x') : boolean
|
|
105
110
|
{
|
|
106
|
-
if ( !
|
|
111
|
+
if ( !(value instanceof Now) ) {
|
|
107
112
|
value = Now.make(value);
|
|
108
113
|
}
|
|
109
114
|
|
|
@@ -119,7 +124,7 @@ export class PicoNowMatchInstance
|
|
|
119
124
|
* @param {string} [format] Compare format
|
|
120
125
|
* @returns {boolean} True if equal
|
|
121
126
|
*/
|
|
122
|
-
equalDate(value = null, format = 'YYYYMMDD')
|
|
127
|
+
equalDate(value : any = null, format : string = 'YYYYMMDD') : boolean
|
|
123
128
|
{
|
|
124
129
|
return this.equal(value, format);
|
|
125
130
|
}
|
|
@@ -133,7 +138,7 @@ export class PicoNowMatchInstance
|
|
|
133
138
|
* @param {string} [format] Compare format
|
|
134
139
|
* @returns {boolean} True if equal
|
|
135
140
|
*/
|
|
136
|
-
equalTime(value = null, format = 'HHmmss')
|
|
141
|
+
equalTime(value : any = null, format : string = 'HHmmss') : boolean
|
|
137
142
|
{
|
|
138
143
|
return this.equal(value, format);
|
|
139
144
|
}
|
|
@@ -148,7 +153,7 @@ export class PicoNowMatchInstance
|
|
|
148
153
|
* @param {string} [format] Compare format
|
|
149
154
|
* @returns {boolean} True if between
|
|
150
155
|
*/
|
|
151
|
-
between(start = null, end = null, format = 'YYYYMMDD')
|
|
156
|
+
between(start : any = null, end : any = null, format : string = 'YYYYMMDD') : boolean
|
|
152
157
|
{
|
|
153
158
|
let dates = [
|
|
154
159
|
Now.make(start), Now.make(end)
|
|
@@ -163,15 +168,4 @@ export class PicoNowMatchInstance
|
|
|
163
168
|
|
|
164
169
|
}
|
|
165
170
|
|
|
166
|
-
|
|
167
|
-
* @param {typeof PicoNow} self
|
|
168
|
-
* @returns {typeof PicoNow}
|
|
169
|
-
*/
|
|
170
|
-
export const PicoNowMatchPlugin = function (self) {
|
|
171
|
-
|
|
172
|
-
Obj.each(Mix.proto(PicoNowMatchInstance), (fn, id) => {
|
|
173
|
-
self.prototype[id] = fn;
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
return self;
|
|
177
|
-
}
|
|
171
|
+
export default PicoNowMatch;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PicoNow } from "../utils/Now.
|
|
1
|
+
import { Now, Arr } from "../index.esm.ts";
|
|
2
|
+
import { PicoNow, PicoNowInterface } from "../utils/Now.ts";
|
|
3
|
+
|
|
4
|
+
export interface PicoNowRange extends PicoNowInterface
|
|
5
|
+
{
|
|
6
|
+
//
|
|
7
|
+
}
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* @memberof PicoNow
|
|
6
|
-
* @extends {PicoNow}
|
|
7
11
|
*/
|
|
8
|
-
export class
|
|
12
|
+
export class PicoNowRange
|
|
9
13
|
{
|
|
10
14
|
|
|
11
15
|
/**
|
|
@@ -17,7 +21,7 @@ export class PicoNowRangeInstance
|
|
|
17
21
|
* @param {string} [scope] Range scope
|
|
18
22
|
* @returns {Array<PicoNow>} Array of dates
|
|
19
23
|
*/
|
|
20
|
-
range(value = null, scope = 'date')
|
|
24
|
+
range(value:any = null, scope:string = 'date'):Array<PicoNow>
|
|
21
25
|
{
|
|
22
26
|
let format = 'YYYYMMDD';
|
|
23
27
|
|
|
@@ -50,23 +54,10 @@ export class PicoNowRangeInstance
|
|
|
50
54
|
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
PicoNowRangeInstance.prototype.getDatesRange = function (...args) {
|
|
57
|
-
console.warn('NowRange.getDatesRange() is deprecated, use NowRange.range() instead.');
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
PicoNowRange.prototype.getDatesRange = function (...args:Parameters<typeof PicoNowRange.range>) {
|
|
59
|
+
console.warn('Now.getDatesRange() is deprecated, use Now.range() instead.');
|
|
58
60
|
return this.range(...args);
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
* @param {typeof PicoNow} self
|
|
63
|
-
* @returns {typeof PicoNow}
|
|
64
|
-
*/
|
|
65
|
-
export const PicoNowRangePlugin = function (self) {
|
|
66
|
-
|
|
67
|
-
Obj.each(Mix.proto(PicoNowRangeInstance), (fn, id) => {
|
|
68
|
-
self.prototype[id] = fn;
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
return self;
|
|
72
|
-
}
|
|
63
|
+
export default PicoNowRange;
|