@bitbybit-dev/base 0.19.9 → 0.20.0

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.
@@ -0,0 +1,216 @@
1
+ export declare namespace Dates {
2
+ class DateDto {
3
+ constructor(date?: Date);
4
+ /**
5
+ * The date
6
+ * @default undefined
7
+ */
8
+ date: Date;
9
+ }
10
+ class DateStringDto {
11
+ constructor(dateString?: string);
12
+ /**
13
+ * The date string
14
+ * @default undefined
15
+ */
16
+ dateString: string;
17
+ }
18
+ class DateSecondsDto {
19
+ constructor(date?: Date, seconds?: number);
20
+ /**
21
+ * The date to update the seconds for
22
+ * @default undefined
23
+ */
24
+ date: Date;
25
+ /**
26
+ * The seconds of the date
27
+ * @default 30
28
+ * @minimum 0
29
+ * @maximum Infinity
30
+ * @step 1
31
+ */
32
+ seconds: number;
33
+ }
34
+ class DateDayDto {
35
+ constructor(date?: Date, day?: number);
36
+ /**
37
+ * The date
38
+ * @default undefined
39
+ */
40
+ date: Date;
41
+ /**
42
+ * The day of the date
43
+ * @default 1
44
+ * @minimum 0
45
+ * @maximum Infinity
46
+ * @step 1
47
+ */
48
+ day: number;
49
+ }
50
+ class DateYearDto {
51
+ constructor(date?: Date, year?: number);
52
+ /**
53
+ * The date
54
+ * @default undefined
55
+ */
56
+ date: Date;
57
+ /**
58
+ * The year of the date
59
+ * @default 1
60
+ * @minimum 0
61
+ * @maximum Infinity
62
+ * @step 1
63
+ */
64
+ year: number;
65
+ }
66
+ class DateMonthDto {
67
+ constructor(date?: Date, month?: number);
68
+ /**
69
+ * The date
70
+ * @default undefined
71
+ */
72
+ date: Date;
73
+ /**
74
+ * The month of the date
75
+ * @default 1
76
+ * @minimum 0
77
+ * @maximum Infinity
78
+ * @step 1
79
+ */
80
+ month: number;
81
+ }
82
+ class DateHoursDto {
83
+ constructor(date?: Date, hours?: number);
84
+ /**
85
+ * The date
86
+ * @default undefined
87
+ */
88
+ date: Date;
89
+ /**
90
+ * The hours of the date
91
+ * @default 1
92
+ * @minimum 0
93
+ * @maximum Infinity
94
+ * @step 1
95
+ */
96
+ hours: number;
97
+ }
98
+ class DateMinutesDto {
99
+ constructor(date?: Date, minutes?: number);
100
+ /**
101
+ * The date
102
+ * @default undefined
103
+ */
104
+ date: Date;
105
+ /**
106
+ * The minutes of the date
107
+ * @default 1
108
+ * @minimum 0
109
+ * @maximum Infinity
110
+ * @step 1
111
+ */
112
+ minutes: number;
113
+ }
114
+ class DateMillisecondsDto {
115
+ constructor(date?: Date, milliseconds?: number);
116
+ /**
117
+ * The date
118
+ * @default undefined
119
+ */
120
+ date: Date;
121
+ /**
122
+ * The milliseconds of the date
123
+ * @default 1
124
+ * @minimum 0
125
+ * @maximum Infinity
126
+ * @step 1
127
+ */
128
+ milliseconds: number;
129
+ }
130
+ class DateTimeDto {
131
+ constructor(date?: Date, time?: number);
132
+ /**
133
+ * The date
134
+ * @default undefined
135
+ */
136
+ date: Date;
137
+ /**
138
+ * The time of the date
139
+ * @default 1
140
+ * @minimum 0
141
+ * @maximum Infinity
142
+ * @step 1
143
+ */
144
+ time: number;
145
+ }
146
+ class CreateFromUnixTimeStampDto {
147
+ constructor(unixTimeStamp?: number);
148
+ /**
149
+ * The unix time stamp
150
+ * @default 1
151
+ * @minimum 0
152
+ * @maximum Infinity
153
+ * @step 1
154
+ */
155
+ unixTimeStamp: number;
156
+ }
157
+ class CreateDateDto {
158
+ constructor(year?: number, month?: number, day?: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number);
159
+ /**
160
+ * The year of the date
161
+ * @default 1
162
+ * @minimum 0
163
+ * @maximum Infinity
164
+ * @step 1
165
+ */
166
+ year: number;
167
+ /**
168
+ * The month of the date
169
+ * @default 1
170
+ * @minimum 0
171
+ * @maximum Infinity
172
+ * @step 1
173
+ */
174
+ month: number;
175
+ /**
176
+ * The day of the month
177
+ * @default 1
178
+ * @minimum 0
179
+ * @maximum Infinity
180
+ * @step 1
181
+ */
182
+ day: number;
183
+ /**
184
+ * The hours of the date
185
+ * @default 1
186
+ * @minimum 0
187
+ * @maximum Infinity
188
+ * @step 1
189
+ */
190
+ hours: number;
191
+ /**
192
+ * The minutes of the date
193
+ * @default 1
194
+ * @minimum 0
195
+ * @maximum Infinity
196
+ * @step 1
197
+ */
198
+ minutes: number;
199
+ /**
200
+ * The seconds of the date
201
+ * @default 1
202
+ * @minimum 0
203
+ * @maximum Infinity
204
+ * @step 1
205
+ */
206
+ seconds: number;
207
+ /**
208
+ * The milliseconds of the date
209
+ * @default 1
210
+ * @minimum 0
211
+ * @maximum Infinity
212
+ * @step 1
213
+ */
214
+ milliseconds: number;
215
+ }
216
+ }
@@ -0,0 +1,271 @@
1
+ /* eslint-disable @typescript-eslint/no-namespace */
2
+ // tslint:disable-next-line: no-namespace
3
+ export var Dates;
4
+ (function (Dates) {
5
+ class DateDto {
6
+ constructor(date) {
7
+ if (date !== undefined) {
8
+ this.date = date;
9
+ }
10
+ }
11
+ }
12
+ Dates.DateDto = DateDto;
13
+ class DateStringDto {
14
+ constructor(dateString) {
15
+ if (dateString !== undefined) {
16
+ this.dateString = dateString;
17
+ }
18
+ }
19
+ }
20
+ Dates.DateStringDto = DateStringDto;
21
+ class DateSecondsDto {
22
+ constructor(date, seconds) {
23
+ /**
24
+ * The seconds of the date
25
+ * @default 30
26
+ * @minimum 0
27
+ * @maximum Infinity
28
+ * @step 1
29
+ */
30
+ this.seconds = 30;
31
+ if (date !== undefined) {
32
+ this.date = date;
33
+ }
34
+ if (seconds !== undefined) {
35
+ this.seconds = seconds;
36
+ }
37
+ }
38
+ }
39
+ Dates.DateSecondsDto = DateSecondsDto;
40
+ class DateDayDto {
41
+ constructor(date, day) {
42
+ /**
43
+ * The day of the date
44
+ * @default 1
45
+ * @minimum 0
46
+ * @maximum Infinity
47
+ * @step 1
48
+ */
49
+ this.day = 1;
50
+ if (date !== undefined) {
51
+ this.date = date;
52
+ }
53
+ if (day !== undefined) {
54
+ this.day = day;
55
+ }
56
+ }
57
+ }
58
+ Dates.DateDayDto = DateDayDto;
59
+ class DateYearDto {
60
+ constructor(date, year) {
61
+ /**
62
+ * The year of the date
63
+ * @default 1
64
+ * @minimum 0
65
+ * @maximum Infinity
66
+ * @step 1
67
+ */
68
+ this.year = 1;
69
+ if (date !== undefined) {
70
+ this.date = date;
71
+ }
72
+ if (year !== undefined) {
73
+ this.year = year;
74
+ }
75
+ }
76
+ }
77
+ Dates.DateYearDto = DateYearDto;
78
+ class DateMonthDto {
79
+ constructor(date, month) {
80
+ /**
81
+ * The month of the date
82
+ * @default 1
83
+ * @minimum 0
84
+ * @maximum Infinity
85
+ * @step 1
86
+ */
87
+ this.month = 1;
88
+ if (date !== undefined) {
89
+ this.date = date;
90
+ }
91
+ if (month !== undefined) {
92
+ this.month = month;
93
+ }
94
+ }
95
+ }
96
+ Dates.DateMonthDto = DateMonthDto;
97
+ class DateHoursDto {
98
+ constructor(date, hours) {
99
+ /**
100
+ * The hours of the date
101
+ * @default 1
102
+ * @minimum 0
103
+ * @maximum Infinity
104
+ * @step 1
105
+ */
106
+ this.hours = 1;
107
+ if (date !== undefined) {
108
+ this.date = date;
109
+ }
110
+ if (hours !== undefined) {
111
+ this.hours = hours;
112
+ }
113
+ }
114
+ }
115
+ Dates.DateHoursDto = DateHoursDto;
116
+ class DateMinutesDto {
117
+ constructor(date, minutes) {
118
+ /**
119
+ * The minutes of the date
120
+ * @default 1
121
+ * @minimum 0
122
+ * @maximum Infinity
123
+ * @step 1
124
+ */
125
+ this.minutes = 1;
126
+ if (date !== undefined) {
127
+ this.date = date;
128
+ }
129
+ if (minutes !== undefined) {
130
+ this.minutes = minutes;
131
+ }
132
+ }
133
+ }
134
+ Dates.DateMinutesDto = DateMinutesDto;
135
+ class DateMillisecondsDto {
136
+ constructor(date, milliseconds) {
137
+ /**
138
+ * The milliseconds of the date
139
+ * @default 1
140
+ * @minimum 0
141
+ * @maximum Infinity
142
+ * @step 1
143
+ */
144
+ this.milliseconds = 1;
145
+ if (date !== undefined) {
146
+ this.date = date;
147
+ }
148
+ if (milliseconds !== undefined) {
149
+ this.milliseconds = milliseconds;
150
+ }
151
+ }
152
+ }
153
+ Dates.DateMillisecondsDto = DateMillisecondsDto;
154
+ class DateTimeDto {
155
+ constructor(date, time) {
156
+ /**
157
+ * The time of the date
158
+ * @default 1
159
+ * @minimum 0
160
+ * @maximum Infinity
161
+ * @step 1
162
+ */
163
+ this.time = 1;
164
+ if (date !== undefined) {
165
+ this.date = date;
166
+ }
167
+ if (time !== undefined) {
168
+ this.time = time;
169
+ }
170
+ }
171
+ }
172
+ Dates.DateTimeDto = DateTimeDto;
173
+ class CreateFromUnixTimeStampDto {
174
+ constructor(unixTimeStamp) {
175
+ /**
176
+ * The unix time stamp
177
+ * @default 1
178
+ * @minimum 0
179
+ * @maximum Infinity
180
+ * @step 1
181
+ */
182
+ this.unixTimeStamp = 1;
183
+ if (unixTimeStamp !== undefined) {
184
+ this.unixTimeStamp = unixTimeStamp;
185
+ }
186
+ }
187
+ }
188
+ Dates.CreateFromUnixTimeStampDto = CreateFromUnixTimeStampDto;
189
+ class CreateDateDto {
190
+ constructor(year, month, day, hours, minutes, seconds, milliseconds) {
191
+ /**
192
+ * The year of the date
193
+ * @default 1
194
+ * @minimum 0
195
+ * @maximum Infinity
196
+ * @step 1
197
+ */
198
+ this.year = 1;
199
+ /**
200
+ * The month of the date
201
+ * @default 1
202
+ * @minimum 0
203
+ * @maximum Infinity
204
+ * @step 1
205
+ */
206
+ this.month = 1;
207
+ /**
208
+ * The day of the month
209
+ * @default 1
210
+ * @minimum 0
211
+ * @maximum Infinity
212
+ * @step 1
213
+ */
214
+ this.day = 1;
215
+ /**
216
+ * The hours of the date
217
+ * @default 1
218
+ * @minimum 0
219
+ * @maximum Infinity
220
+ * @step 1
221
+ */
222
+ this.hours = 1;
223
+ /**
224
+ * The minutes of the date
225
+ * @default 1
226
+ * @minimum 0
227
+ * @maximum Infinity
228
+ * @step 1
229
+ */
230
+ this.minutes = 1;
231
+ /**
232
+ * The seconds of the date
233
+ * @default 1
234
+ * @minimum 0
235
+ * @maximum Infinity
236
+ * @step 1
237
+ */
238
+ this.seconds = 1;
239
+ /**
240
+ * The milliseconds of the date
241
+ * @default 1
242
+ * @minimum 0
243
+ * @maximum Infinity
244
+ * @step 1
245
+ */
246
+ this.milliseconds = 1;
247
+ if (year !== undefined) {
248
+ this.year = year;
249
+ }
250
+ if (month !== undefined) {
251
+ this.month = month;
252
+ }
253
+ if (day !== undefined) {
254
+ this.day = day;
255
+ }
256
+ if (hours !== undefined) {
257
+ this.hours = hours;
258
+ }
259
+ if (minutes !== undefined) {
260
+ this.minutes = minutes;
261
+ }
262
+ if (seconds !== undefined) {
263
+ this.seconds = seconds;
264
+ }
265
+ if (milliseconds !== undefined) {
266
+ this.milliseconds = milliseconds;
267
+ }
268
+ }
269
+ }
270
+ Dates.CreateDateDto = CreateDateDto;
271
+ })(Dates || (Dates = {}));
@@ -7,3 +7,4 @@ export * from "./text-inputs";
7
7
  export * from "./vector-inputs";
8
8
  export * from "./transforms-inputs";
9
9
  export * from "./base-inputs";
10
+ export * from "./dates-inputs";
@@ -7,3 +7,4 @@ export * from "./text-inputs";
7
7
  export * from "./vector-inputs";
8
8
  export * from "./transforms-inputs";
9
9
  export * from "./base-inputs";
10
+ export * from "./dates-inputs";
@@ -7,3 +7,4 @@ export * from "./text-inputs";
7
7
  export * from "./text-inputs";
8
8
  export * from "./vector-inputs";
9
9
  export * from "./transforms-inputs";
10
+ export * from "./dates-inputs";
@@ -7,3 +7,4 @@ export * from "./text-inputs";
7
7
  export * from "./text-inputs";
8
8
  export * from "./vector-inputs";
9
9
  export * from "./transforms-inputs";
10
+ export * from "./dates-inputs";
@@ -0,0 +1,367 @@
1
+ import * as Inputs from "../inputs";
2
+ /**
3
+ * Contains various date methods.
4
+ */
5
+ export declare class Dates {
6
+ /**
7
+ * Returns a date as a string value.
8
+ * @param inputs a date
9
+ * @returns date as string
10
+ * @group convert
11
+ * @shortname date to string
12
+ * @drawable false
13
+ */
14
+ toDateString(inputs: Inputs.Dates.DateDto): string;
15
+ /**
16
+ * Returns a date as a string value in ISO format.
17
+ * @param inputs a date
18
+ * @returns date as string
19
+ * @group convert
20
+ * @shortname date to iso string
21
+ * @drawable false
22
+ */
23
+ toISOString(inputs: Inputs.Dates.DateDto): string;
24
+ /**
25
+ * Returns a date as a string value in JSON format.
26
+ * @param inputs a date
27
+ * @returns date as string
28
+ * @group convert
29
+ * @shortname date to json
30
+ * @drawable false
31
+ */
32
+ toJSON(inputs: Inputs.Dates.DateDto): string;
33
+ /**
34
+ * Returns a string representation of a date. The format of the string depends on the locale.
35
+ * @param inputs a date
36
+ * @returns date as string
37
+ * @group convert
38
+ * @shortname date to locale string
39
+ * @drawable false
40
+ */
41
+ toString(inputs: Inputs.Dates.DateDto): string;
42
+ /**
43
+ * Returns a time as a string value.
44
+ * @param inputs a date
45
+ * @returns time as string
46
+ * @group convert
47
+ * @shortname date to time string
48
+ * @drawable false
49
+ */
50
+ toTimeString(inputs: Inputs.Dates.DateDto): string;
51
+ /**
52
+ * Returns a date converted to a string using Universal Coordinated Time (UTC).
53
+ * @param inputs a date
54
+ * @returns date as utc string
55
+ * @group convert
56
+ * @shortname date to utc string
57
+ * @drawable false
58
+ */
59
+ toUTCString(inputs: Inputs.Dates.DateDto): string;
60
+ /**
61
+ * Returns the current date and time.
62
+ * @returns date
63
+ * @group create
64
+ * @shortname now
65
+ * @drawable false
66
+ */
67
+ now(): Date;
68
+ /**
69
+ * Creates a new date object using the provided date params.
70
+ * @param inputs a date
71
+ * @returns date
72
+ * @group create
73
+ * @shortname create date
74
+ * @drawable false
75
+ */
76
+ createDate(inputs: Inputs.Dates.CreateDateDto): Date;
77
+ /**
78
+ * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
79
+ * @param inputs a date
80
+ * @returns date
81
+ * @group create
82
+ * @shortname create utc date
83
+ * @drawable false
84
+ */
85
+ createDateUTC(inputs: Inputs.Dates.CreateDateDto): Date;
86
+ /**
87
+ * Creates a new date object using the provided unix time stamp.
88
+ * @param inputs a unix time stamp
89
+ * @returns date
90
+ * @group create
91
+ * @shortname create from unix timestamp
92
+ * @drawable false
93
+ */
94
+ createFromUnixTimeStamp(inputs: Inputs.Dates.CreateFromUnixTimeStampDto): Date;
95
+ /**
96
+ * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.
97
+ * @param inputs a date string
98
+ * @returns the number of milliseconds between that date and midnight, January 1, 1970.
99
+ * @group parse
100
+ * @shortname parse date string
101
+ * @drawable false
102
+ */
103
+ parseDate(inputs: Inputs.Dates.DateStringDto): number;
104
+ /**
105
+ * Gets the day-of-the-month, using local time.
106
+ * @returns date
107
+ * @group get
108
+ * @shortname get date of month
109
+ * @drawable false
110
+ */
111
+ getDayOfMonth(inputs: Inputs.Dates.DateDto): number;
112
+ /**
113
+ * Gets the day of the week, using local time.
114
+ * @returns day
115
+ * @group get
116
+ * @shortname get weekday
117
+ * @drawable false
118
+ */
119
+ getWeekday(inputs: Inputs.Dates.DateDto): number;
120
+ /**
121
+ * Gets the year, using local time.
122
+ * @returns year
123
+ * @group get
124
+ * @shortname get year
125
+ * @drawable false
126
+ */
127
+ getYear(inputs: Inputs.Dates.DateDto): number;
128
+ /**
129
+ * Gets the month, using local time.
130
+ * @returns month
131
+ * @group get
132
+ * @shortname get month
133
+ * @drawable false
134
+ */
135
+ getMonth(inputs: Inputs.Dates.DateDto): number;
136
+ /**
137
+ * Gets the hours in a date, using local time.
138
+ * @returns hours
139
+ * @group get
140
+ * @shortname get hours
141
+ * @drawable false
142
+ */
143
+ getHours(inputs: Inputs.Dates.DateDto): number;
144
+ /**
145
+ * Gets the minutes of a Date object, using local time.
146
+ * @returns minutes
147
+ * @group get
148
+ * @shortname get minutes
149
+ * @drawable false
150
+ */
151
+ getMinutes(inputs: Inputs.Dates.DateDto): number;
152
+ /**
153
+ * Gets the seconds of a Date object, using local time.
154
+ * @returns seconds
155
+ * @group get
156
+ * @shortname get seconds
157
+ * @drawable false
158
+ */
159
+ getSeconds(inputs: Inputs.Dates.DateDto): number;
160
+ /**
161
+ * Gets the milliseconds of a Date, using local time.
162
+ * @returns milliseconds
163
+ * @group get
164
+ * @shortname get milliseconds
165
+ * @drawable false
166
+ */
167
+ getMilliseconds(inputs: Inputs.Dates.DateDto): number;
168
+ /**
169
+ * Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC.
170
+ * @returns time
171
+ * @group get
172
+ * @shortname get time
173
+ * @drawable false
174
+ */
175
+ getTime(inputs: Inputs.Dates.DateDto): number;
176
+ /**
177
+ * Gets the year using Universal Coordinated Time (UTC).
178
+ * @returns year
179
+ * @group get
180
+ * @shortname get utc year
181
+ * @drawable false
182
+ */
183
+ getUTCYear(inputs: Inputs.Dates.DateDto): number;
184
+ /**
185
+ * Gets the month of a Date object using Universal Coordinated Time (UTC).
186
+ * @returns month
187
+ * @group get
188
+ * @shortname get utc month
189
+ * @drawable false
190
+ */
191
+ getUTCMonth(inputs: Inputs.Dates.DateDto): number;
192
+ /**
193
+ * Gets the day-of-the-month, using Universal Coordinated Time (UTC).
194
+ * @returns day
195
+ * @group get
196
+ * @shortname get utc day
197
+ * @drawable false
198
+ */
199
+ getUTCDay(inputs: Inputs.Dates.DateDto): number;
200
+ /**
201
+ * Gets the hours value in a Date object using Universal Coordinated Time (UTC).
202
+ * @returns hours
203
+ * @group get
204
+ * @shortname get utc hours
205
+ * @drawable false
206
+ */
207
+ getUTCHours(inputs: Inputs.Dates.DateDto): number;
208
+ /**
209
+ * Gets the minutes of a Date object using Universal Coordinated Time (UTC).
210
+ * @returns minutes
211
+ * @group get
212
+ * @shortname get utc minutes
213
+ * @drawable false
214
+ */
215
+ getUTCMinutes(inputs: Inputs.Dates.DateDto): number;
216
+ /**
217
+ * Gets the seconds of a Date object using Universal Coordinated Time (UTC).
218
+ * @returns seconds
219
+ * @group get
220
+ * @shortname get utc seconds
221
+ * @drawable false
222
+ */
223
+ getUTCSeconds(inputs: Inputs.Dates.DateDto): number;
224
+ /**
225
+ * Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).
226
+ * @returns milliseconds
227
+ * @group get
228
+ * @shortname get utc milliseconds
229
+ * @drawable false
230
+ */
231
+ getUTCMilliseconds(inputs: Inputs.Dates.DateDto): number;
232
+ /**
233
+ * Sets the year of the Date object using local time.
234
+ * @param inputs a date and the year
235
+ * @returns date
236
+ * @group set
237
+ * @shortname set year
238
+ * @drawable false
239
+ * */
240
+ setYear(inputs: Inputs.Dates.DateYearDto): Date;
241
+ /**
242
+ * Sets the month value in the Date object using local time.
243
+ * @param inputs a date and the month
244
+ * @returns date
245
+ * @group set
246
+ * @shortname set month
247
+ * @drawable false
248
+ * */
249
+ setMonth(inputs: Inputs.Dates.DateMonthDto): Date;
250
+ /**
251
+ * Sets the numeric day-of-the-month value of the Date object using local time.
252
+ * @param inputs a date and the day
253
+ * @returns date
254
+ * @group set
255
+ * @shortname set day of month
256
+ * @drawable false
257
+ */
258
+ setDayOfMonth(inputs: Inputs.Dates.DateDayDto): Date;
259
+ /**
260
+ * Sets the hour value in the Date object using local time.
261
+ * @param inputs a date and the hours
262
+ * @returns date
263
+ * @group set
264
+ * @shortname set hours
265
+ * @drawable false
266
+ * */
267
+ setHours(inputs: Inputs.Dates.DateHoursDto): Date;
268
+ /**
269
+ * Sets the minutes value in the Date object using local time.
270
+ * @param inputs a date and the minutes
271
+ * @returns date
272
+ * @group set
273
+ * @shortname set minutes
274
+ * @drawable false
275
+ * */
276
+ setMinutes(inputs: Inputs.Dates.DateMinutesDto): Date;
277
+ /**
278
+ * Sets the seconds value in the Date object using local time.
279
+ * @param inputs a date and the seconds
280
+ * @returns date
281
+ * @group set
282
+ * @shortname set seconds
283
+ * @drawable false
284
+ */
285
+ setSeconds(inputs: Inputs.Dates.DateSecondsDto): Date;
286
+ /**
287
+ * Sets the milliseconds value in the Date object using local time.
288
+ * @param inputs a date and the milliseconds
289
+ * @returns date
290
+ * @group set
291
+ * @shortname set milliseconds
292
+ * @drawable false
293
+ */
294
+ setMilliseconds(inputs: Inputs.Dates.DateMillisecondsDto): Date;
295
+ /**
296
+ * Sets the date and time value in the Date object.
297
+ * @param inputs a date and the time
298
+ * @returns date
299
+ * @group set
300
+ * @shortname set time
301
+ * @drawable false
302
+ */
303
+ setTime(inputs: Inputs.Dates.DateTimeDto): Date;
304
+ /**
305
+ * Sets the year value in the Date object using Universal Coordinated Time (UTC).
306
+ * @param inputs a date and the year
307
+ * @returns date
308
+ * @group set
309
+ * @shortname set utc year
310
+ * @drawable false
311
+ * */
312
+ setUTCYear(inputs: Inputs.Dates.DateYearDto): Date;
313
+ /**
314
+ * Sets the month value in the Date object using Universal Coordinated Time (UTC).
315
+ * @param inputs a date and the month
316
+ * @returns date
317
+ * @group set
318
+ * @shortname set utc month
319
+ * @drawable false
320
+ * */
321
+ setUTCMonth(inputs: Inputs.Dates.DateMonthDto): Date;
322
+ /**
323
+ * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
324
+ * @param inputs a date and the day
325
+ * @returns date
326
+ * @group set
327
+ * @shortname set utc day
328
+ * @drawable false
329
+ */
330
+ setUTCDay(inputs: Inputs.Dates.DateDayDto): Date;
331
+ /**
332
+ * Sets the hours value in the Date object using Universal Coordinated Time (UTC).
333
+ * @param inputs a date and the hours
334
+ * @returns date
335
+ * @group set
336
+ * @shortname set utc hours
337
+ * @drawable false
338
+ * */
339
+ setUTCHours(inputs: Inputs.Dates.DateHoursDto): Date;
340
+ /**
341
+ * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).
342
+ * @param inputs a date and the minutes
343
+ * @returns date
344
+ * @group set
345
+ * @shortname set utc minutes
346
+ * @drawable false
347
+ * */
348
+ setUTCMinutes(inputs: Inputs.Dates.DateMinutesDto): Date;
349
+ /**
350
+ * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).
351
+ * @param inputs a date and the seconds
352
+ * @returns date
353
+ * @group set
354
+ * @shortname set utc seconds
355
+ * @drawable false
356
+ */
357
+ setUTCSeconds(inputs: Inputs.Dates.DateSecondsDto): Date;
358
+ /**
359
+ * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
360
+ * @param inputs a date and the milliseconds
361
+ * @returns date
362
+ * @group set
363
+ * @shortname set utc milliseconds
364
+ * @drawable false
365
+ */
366
+ setUTCMilliseconds(inputs: Inputs.Dates.DateMillisecondsDto): Date;
367
+ }
@@ -0,0 +1,450 @@
1
+ /**
2
+ * Contains various date methods.
3
+ */
4
+ export class Dates {
5
+ /**
6
+ * Returns a date as a string value.
7
+ * @param inputs a date
8
+ * @returns date as string
9
+ * @group convert
10
+ * @shortname date to string
11
+ * @drawable false
12
+ */
13
+ toDateString(inputs) {
14
+ return inputs.date.toDateString();
15
+ }
16
+ /**
17
+ * Returns a date as a string value in ISO format.
18
+ * @param inputs a date
19
+ * @returns date as string
20
+ * @group convert
21
+ * @shortname date to iso string
22
+ * @drawable false
23
+ */
24
+ toISOString(inputs) {
25
+ return inputs.date.toISOString();
26
+ }
27
+ /**
28
+ * Returns a date as a string value in JSON format.
29
+ * @param inputs a date
30
+ * @returns date as string
31
+ * @group convert
32
+ * @shortname date to json
33
+ * @drawable false
34
+ */
35
+ toJSON(inputs) {
36
+ return inputs.date.toJSON();
37
+ }
38
+ /**
39
+ * Returns a string representation of a date. The format of the string depends on the locale.
40
+ * @param inputs a date
41
+ * @returns date as string
42
+ * @group convert
43
+ * @shortname date to locale string
44
+ * @drawable false
45
+ */
46
+ toString(inputs) {
47
+ return inputs.date.toString();
48
+ }
49
+ /**
50
+ * Returns a time as a string value.
51
+ * @param inputs a date
52
+ * @returns time as string
53
+ * @group convert
54
+ * @shortname date to time string
55
+ * @drawable false
56
+ */
57
+ toTimeString(inputs) {
58
+ return inputs.date.toTimeString();
59
+ }
60
+ /**
61
+ * Returns a date converted to a string using Universal Coordinated Time (UTC).
62
+ * @param inputs a date
63
+ * @returns date as utc string
64
+ * @group convert
65
+ * @shortname date to utc string
66
+ * @drawable false
67
+ */
68
+ toUTCString(inputs) {
69
+ return inputs.date.toUTCString();
70
+ }
71
+ /**
72
+ * Returns the current date and time.
73
+ * @returns date
74
+ * @group create
75
+ * @shortname now
76
+ * @drawable false
77
+ */
78
+ now() {
79
+ return new Date(Date.now());
80
+ }
81
+ /**
82
+ * Creates a new date object using the provided date params.
83
+ * @param inputs a date
84
+ * @returns date
85
+ * @group create
86
+ * @shortname create date
87
+ * @drawable false
88
+ */
89
+ createDate(inputs) {
90
+ return new Date(inputs.year, inputs.month, inputs.day, inputs.hours, inputs.minutes, inputs.seconds, inputs.milliseconds);
91
+ }
92
+ /**
93
+ * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
94
+ * @param inputs a date
95
+ * @returns date
96
+ * @group create
97
+ * @shortname create utc date
98
+ * @drawable false
99
+ */
100
+ createDateUTC(inputs) {
101
+ return new Date(Date.UTC(inputs.year, inputs.month, inputs.day, inputs.hours, inputs.minutes, inputs.seconds, inputs.milliseconds));
102
+ }
103
+ /**
104
+ * Creates a new date object using the provided unix time stamp.
105
+ * @param inputs a unix time stamp
106
+ * @returns date
107
+ * @group create
108
+ * @shortname create from unix timestamp
109
+ * @drawable false
110
+ */
111
+ createFromUnixTimeStamp(inputs) {
112
+ return new Date(inputs.unixTimeStamp);
113
+ }
114
+ /**
115
+ * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.
116
+ * @param inputs a date string
117
+ * @returns the number of milliseconds between that date and midnight, January 1, 1970.
118
+ * @group parse
119
+ * @shortname parse date string
120
+ * @drawable false
121
+ */
122
+ parseDate(inputs) {
123
+ return Date.parse(inputs.dateString);
124
+ }
125
+ /**
126
+ * Gets the day-of-the-month, using local time.
127
+ * @returns date
128
+ * @group get
129
+ * @shortname get date of month
130
+ * @drawable false
131
+ */
132
+ getDayOfMonth(inputs) {
133
+ return inputs.date.getDate();
134
+ }
135
+ /**
136
+ * Gets the day of the week, using local time.
137
+ * @returns day
138
+ * @group get
139
+ * @shortname get weekday
140
+ * @drawable false
141
+ */
142
+ getWeekday(inputs) {
143
+ return inputs.date.getDay();
144
+ }
145
+ /**
146
+ * Gets the year, using local time.
147
+ * @returns year
148
+ * @group get
149
+ * @shortname get year
150
+ * @drawable false
151
+ */
152
+ getYear(inputs) {
153
+ return inputs.date.getFullYear();
154
+ }
155
+ /**
156
+ * Gets the month, using local time.
157
+ * @returns month
158
+ * @group get
159
+ * @shortname get month
160
+ * @drawable false
161
+ */
162
+ getMonth(inputs) {
163
+ return inputs.date.getMonth();
164
+ }
165
+ /**
166
+ * Gets the hours in a date, using local time.
167
+ * @returns hours
168
+ * @group get
169
+ * @shortname get hours
170
+ * @drawable false
171
+ */
172
+ getHours(inputs) {
173
+ return inputs.date.getHours();
174
+ }
175
+ /**
176
+ * Gets the minutes of a Date object, using local time.
177
+ * @returns minutes
178
+ * @group get
179
+ * @shortname get minutes
180
+ * @drawable false
181
+ */
182
+ getMinutes(inputs) {
183
+ return inputs.date.getMinutes();
184
+ }
185
+ /**
186
+ * Gets the seconds of a Date object, using local time.
187
+ * @returns seconds
188
+ * @group get
189
+ * @shortname get seconds
190
+ * @drawable false
191
+ */
192
+ getSeconds(inputs) {
193
+ return inputs.date.getSeconds();
194
+ }
195
+ /**
196
+ * Gets the milliseconds of a Date, using local time.
197
+ * @returns milliseconds
198
+ * @group get
199
+ * @shortname get milliseconds
200
+ * @drawable false
201
+ */
202
+ getMilliseconds(inputs) {
203
+ return inputs.date.getMilliseconds();
204
+ }
205
+ /**
206
+ * Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC.
207
+ * @returns time
208
+ * @group get
209
+ * @shortname get time
210
+ * @drawable false
211
+ */
212
+ getTime(inputs) {
213
+ return inputs.date.getTime();
214
+ }
215
+ /**
216
+ * Gets the year using Universal Coordinated Time (UTC).
217
+ * @returns year
218
+ * @group get
219
+ * @shortname get utc year
220
+ * @drawable false
221
+ */
222
+ getUTCYear(inputs) {
223
+ return inputs.date.getUTCFullYear();
224
+ }
225
+ /**
226
+ * Gets the month of a Date object using Universal Coordinated Time (UTC).
227
+ * @returns month
228
+ * @group get
229
+ * @shortname get utc month
230
+ * @drawable false
231
+ */
232
+ getUTCMonth(inputs) {
233
+ return inputs.date.getUTCMonth();
234
+ }
235
+ /**
236
+ * Gets the day-of-the-month, using Universal Coordinated Time (UTC).
237
+ * @returns day
238
+ * @group get
239
+ * @shortname get utc day
240
+ * @drawable false
241
+ */
242
+ getUTCDay(inputs) {
243
+ return inputs.date.getUTCDate();
244
+ }
245
+ /**
246
+ * Gets the hours value in a Date object using Universal Coordinated Time (UTC).
247
+ * @returns hours
248
+ * @group get
249
+ * @shortname get utc hours
250
+ * @drawable false
251
+ */
252
+ getUTCHours(inputs) {
253
+ return inputs.date.getUTCHours();
254
+ }
255
+ /**
256
+ * Gets the minutes of a Date object using Universal Coordinated Time (UTC).
257
+ * @returns minutes
258
+ * @group get
259
+ * @shortname get utc minutes
260
+ * @drawable false
261
+ */
262
+ getUTCMinutes(inputs) {
263
+ return inputs.date.getUTCMinutes();
264
+ }
265
+ /**
266
+ * Gets the seconds of a Date object using Universal Coordinated Time (UTC).
267
+ * @returns seconds
268
+ * @group get
269
+ * @shortname get utc seconds
270
+ * @drawable false
271
+ */
272
+ getUTCSeconds(inputs) {
273
+ return inputs.date.getUTCSeconds();
274
+ }
275
+ /**
276
+ * Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).
277
+ * @returns milliseconds
278
+ * @group get
279
+ * @shortname get utc milliseconds
280
+ * @drawable false
281
+ */
282
+ getUTCMilliseconds(inputs) {
283
+ return inputs.date.getUTCMilliseconds();
284
+ }
285
+ /**
286
+ * Sets the year of the Date object using local time.
287
+ * @param inputs a date and the year
288
+ * @returns date
289
+ * @group set
290
+ * @shortname set year
291
+ * @drawable false
292
+ * */
293
+ setYear(inputs) {
294
+ return new Date(inputs.date.setFullYear(inputs.year));
295
+ }
296
+ /**
297
+ * Sets the month value in the Date object using local time.
298
+ * @param inputs a date and the month
299
+ * @returns date
300
+ * @group set
301
+ * @shortname set month
302
+ * @drawable false
303
+ * */
304
+ setMonth(inputs) {
305
+ return new Date(inputs.date.setMonth(inputs.month));
306
+ }
307
+ /**
308
+ * Sets the numeric day-of-the-month value of the Date object using local time.
309
+ * @param inputs a date and the day
310
+ * @returns date
311
+ * @group set
312
+ * @shortname set day of month
313
+ * @drawable false
314
+ */
315
+ setDayOfMonth(inputs) {
316
+ return new Date(inputs.date.setDate(inputs.day));
317
+ }
318
+ /**
319
+ * Sets the hour value in the Date object using local time.
320
+ * @param inputs a date and the hours
321
+ * @returns date
322
+ * @group set
323
+ * @shortname set hours
324
+ * @drawable false
325
+ * */
326
+ setHours(inputs) {
327
+ return new Date(inputs.date.setHours(inputs.hours));
328
+ }
329
+ /**
330
+ * Sets the minutes value in the Date object using local time.
331
+ * @param inputs a date and the minutes
332
+ * @returns date
333
+ * @group set
334
+ * @shortname set minutes
335
+ * @drawable false
336
+ * */
337
+ setMinutes(inputs) {
338
+ return new Date(inputs.date.setMinutes(inputs.minutes));
339
+ }
340
+ /**
341
+ * Sets the seconds value in the Date object using local time.
342
+ * @param inputs a date and the seconds
343
+ * @returns date
344
+ * @group set
345
+ * @shortname set seconds
346
+ * @drawable false
347
+ */
348
+ setSeconds(inputs) {
349
+ return new Date(inputs.date.setSeconds(inputs.seconds));
350
+ }
351
+ /**
352
+ * Sets the milliseconds value in the Date object using local time.
353
+ * @param inputs a date and the milliseconds
354
+ * @returns date
355
+ * @group set
356
+ * @shortname set milliseconds
357
+ * @drawable false
358
+ */
359
+ setMilliseconds(inputs) {
360
+ return new Date(inputs.date.setMilliseconds(inputs.milliseconds));
361
+ }
362
+ /**
363
+ * Sets the date and time value in the Date object.
364
+ * @param inputs a date and the time
365
+ * @returns date
366
+ * @group set
367
+ * @shortname set time
368
+ * @drawable false
369
+ */
370
+ setTime(inputs) {
371
+ return new Date(inputs.date.setTime(inputs.time));
372
+ }
373
+ /**
374
+ * Sets the year value in the Date object using Universal Coordinated Time (UTC).
375
+ * @param inputs a date and the year
376
+ * @returns date
377
+ * @group set
378
+ * @shortname set utc year
379
+ * @drawable false
380
+ * */
381
+ setUTCYear(inputs) {
382
+ return new Date(inputs.date.setUTCFullYear(inputs.year));
383
+ }
384
+ /**
385
+ * Sets the month value in the Date object using Universal Coordinated Time (UTC).
386
+ * @param inputs a date and the month
387
+ * @returns date
388
+ * @group set
389
+ * @shortname set utc month
390
+ * @drawable false
391
+ * */
392
+ setUTCMonth(inputs) {
393
+ return new Date(inputs.date.setUTCMonth(inputs.month));
394
+ }
395
+ /**
396
+ * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
397
+ * @param inputs a date and the day
398
+ * @returns date
399
+ * @group set
400
+ * @shortname set utc day
401
+ * @drawable false
402
+ */
403
+ setUTCDay(inputs) {
404
+ return new Date(inputs.date.setUTCDate(inputs.day));
405
+ }
406
+ /**
407
+ * Sets the hours value in the Date object using Universal Coordinated Time (UTC).
408
+ * @param inputs a date and the hours
409
+ * @returns date
410
+ * @group set
411
+ * @shortname set utc hours
412
+ * @drawable false
413
+ * */
414
+ setUTCHours(inputs) {
415
+ return new Date(inputs.date.setUTCHours(inputs.hours));
416
+ }
417
+ /**
418
+ * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).
419
+ * @param inputs a date and the minutes
420
+ * @returns date
421
+ * @group set
422
+ * @shortname set utc minutes
423
+ * @drawable false
424
+ * */
425
+ setUTCMinutes(inputs) {
426
+ return new Date(inputs.date.setUTCMinutes(inputs.minutes));
427
+ }
428
+ /**
429
+ * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).
430
+ * @param inputs a date and the seconds
431
+ * @returns date
432
+ * @group set
433
+ * @shortname set utc seconds
434
+ * @drawable false
435
+ */
436
+ setUTCSeconds(inputs) {
437
+ return new Date(inputs.date.setUTCSeconds(inputs.seconds));
438
+ }
439
+ /**
440
+ * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
441
+ * @param inputs a date and the milliseconds
442
+ * @returns date
443
+ * @group set
444
+ * @shortname set utc milliseconds
445
+ * @drawable false
446
+ */
447
+ setUTCMilliseconds(inputs) {
448
+ return new Date(inputs.date.setUTCMilliseconds(inputs.milliseconds));
449
+ }
450
+ }
@@ -4,6 +4,7 @@ export * from "./logic";
4
4
  export * from "./math";
5
5
  export * from "./point";
6
6
  export * from "./text";
7
+ export * from "./dates";
7
8
  export * from "./vector";
8
9
  export * from "./transforms";
9
10
  export * from "./geometry-helper";
@@ -4,6 +4,7 @@ export * from "./logic";
4
4
  export * from "./math";
5
5
  export * from "./point";
6
6
  export * from "./text";
7
+ export * from "./dates";
7
8
  export * from "./vector";
8
9
  export * from "./transforms";
9
10
  export * from "./geometry-helper";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbybit-dev/base",
3
- "version": "0.19.9",
3
+ "version": "0.20.0",
4
4
  "description": "Bit By Bit Developers Base CAD Library to Program Geometry",
5
5
  "main": "index.js",
6
6
  "repository": {