@tmlmobilidade/dates 20260618.2315.12 → 20260620.940.32

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/dates.d.ts CHANGED
@@ -1,12 +1,16 @@
1
1
  import { type DatesFormat } from './lib/date-format.js';
2
2
  import { type TimezoneIdentified } from './lib/timezone-identified.js';
3
- import { CalendarDate, type OperationalDate, type UnixTimestamp } from '@tmlmobilidade/types';
3
+ import { type CalendarDate, type OperationalDate, type OperationalDateInt, type UnixTimestamp } from '@tmlmobilidade/types';
4
4
  import { type DateObjectUnits, type DateTimeUnit, type DurationObjectUnits } from 'luxon';
5
5
  interface DatesConstructor {
6
6
  calendar_date: CalendarDate;
7
7
  iso: null | string;
8
8
  js_date: Date;
9
+ /**
10
+ * @deprecated Use the operational_date_int field instead, for better performance.
11
+ */
9
12
  operational_date: OperationalDate;
13
+ operational_date_int: OperationalDateInt;
10
14
  std_window: {
11
15
  end: UnixTimestamp;
12
16
  start: UnixTimestamp;
@@ -25,7 +29,11 @@ export declare class Dates {
25
29
  calendar_date: CalendarDate;
26
30
  iso: null | string;
27
31
  js_date: Date;
32
+ /**
33
+ * @deprecated Use the operational_date_int field instead, for better performance.
34
+ */
28
35
  operational_date: OperationalDate;
36
+ operational_date_int: OperationalDateInt;
29
37
  std_window: {
30
38
  end: UnixTimestamp;
31
39
  start: UnixTimestamp;
@@ -187,6 +195,7 @@ export declare class Dates {
187
195
  * @returns The operational date in the yyyyLLdd format.
188
196
  */
189
197
  private getOperationalDate;
198
+ private getOperationalDateInt;
190
199
  /**
191
200
  * This function returns the start and end of the standard window interval for a given timestamp.
192
201
  * The standard window interval is the period in which is possible to receive data for a given ride.
package/dist/dates.js CHANGED
@@ -9,7 +9,11 @@ export class Dates {
9
9
  calendar_date;
10
10
  iso;
11
11
  js_date;
12
+ /**
13
+ * @deprecated Use the operational_date_int field instead, for better performance.
14
+ */
12
15
  operational_date;
16
+ operational_date_int;
13
17
  std_window;
14
18
  unix_timestamp;
15
19
  constructor(params) {
@@ -17,6 +21,7 @@ export class Dates {
17
21
  this.iso = params.iso ?? null;
18
22
  this.js_date = params.js_date;
19
23
  this.operational_date = params.operational_date;
24
+ this.operational_date_int = params.operational_date_int;
20
25
  this.std_window = params.std_window;
21
26
  this.unix_timestamp = params.unix_timestamp;
22
27
  }
@@ -40,6 +45,7 @@ export class Dates {
40
45
  iso: dateTime.toISO(),
41
46
  js_date: dateTime.toJSDate(),
42
47
  operational_date: this.prototype.getOperationalDate(dateTime.toISO()),
48
+ operational_date_int: this.prototype.getOperationalDateInt(dateTime.toISO()),
43
49
  std_window: this.prototype.getStandardWindowInterval(dateTime.toISO()),
44
50
  unix_timestamp: dateTime.toMillis(),
45
51
  });
@@ -57,6 +63,7 @@ export class Dates {
57
63
  iso: dateTime.toISO(),
58
64
  js_date: dateTime.toJSDate(),
59
65
  operational_date: this.prototype.getOperationalDate(dateTime.toISO()),
66
+ operational_date_int: this.prototype.getOperationalDateInt(dateTime.toISO()),
60
67
  std_window: this.prototype.getStandardWindowInterval(dateTime.toISO()),
61
68
  unix_timestamp: dateTime.toMillis(),
62
69
  });
@@ -75,6 +82,7 @@ export class Dates {
75
82
  iso: dateTime.toISO(),
76
83
  js_date: dateTime.toJSDate(),
77
84
  operational_date: this.prototype.getOperationalDate(dateTime.toISO()),
85
+ operational_date_int: this.prototype.getOperationalDateInt(dateTime.toISO()),
78
86
  std_window: this.prototype.getStandardWindowInterval(dateTime.toISO()),
79
87
  unix_timestamp: dateTime.toMillis(),
80
88
  });
@@ -95,6 +103,7 @@ export class Dates {
95
103
  iso: dateTime.toISO(),
96
104
  js_date: dateTime.toJSDate(),
97
105
  operational_date: this.prototype.getOperationalDate(dateTime.toISO()),
106
+ operational_date_int: this.prototype.getOperationalDateInt(dateTime.toISO()),
98
107
  std_window: this.prototype.getStandardWindowInterval(dateTime.toISO()),
99
108
  unix_timestamp: dateTime.toMillis(),
100
109
  });
@@ -113,6 +122,7 @@ export class Dates {
113
122
  iso: dateTime.toISO(),
114
123
  js_date: dateTime.toJSDate(),
115
124
  operational_date: this.prototype.getOperationalDate(dateTime.toISO()),
125
+ operational_date_int: this.prototype.getOperationalDateInt(dateTime.toISO()),
116
126
  std_window: this.prototype.getStandardWindowInterval(dateTime.toISO()),
117
127
  unix_timestamp: dateTime.toMillis(),
118
128
  });
@@ -131,6 +141,7 @@ export class Dates {
131
141
  iso: dateTime.toISO(),
132
142
  js_date: dateTime.toJSDate(),
133
143
  operational_date: this.prototype.getOperationalDate(dateTime.toISO()),
144
+ operational_date_int: this.prototype.getOperationalDateInt(dateTime.toISO()),
134
145
  std_window: this.prototype.getStandardWindowInterval(dateTime.toISO()),
135
146
  unix_timestamp: dateTime.toMillis(),
136
147
  });
@@ -149,6 +160,7 @@ export class Dates {
149
160
  iso: dateTime.toISO(),
150
161
  js_date: dateTime.toJSDate(),
151
162
  operational_date: this.prototype.getOperationalDate(dateTime.toISO()),
163
+ operational_date_int: this.prototype.getOperationalDateInt(dateTime.toISO()),
152
164
  std_window: this.prototype.getStandardWindowInterval(dateTime.toISO()),
153
165
  unix_timestamp: dateTime.toMillis(),
154
166
  });
@@ -197,6 +209,7 @@ export class Dates {
197
209
  iso: dateTime.toISO(),
198
210
  js_date: dateTime.toJSDate(),
199
211
  operational_date: this.getOperationalDate(dateTime.toISO()),
212
+ operational_date_int: this.getOperationalDateInt(dateTime.toISO()),
200
213
  std_window: this.getStandardWindowInterval(dateTime.toISO()),
201
214
  unix_timestamp: dateTime.toMillis(),
202
215
  });
@@ -217,6 +230,7 @@ export class Dates {
217
230
  iso: dateTime.toISO(),
218
231
  js_date: dateTime.toJSDate(),
219
232
  operational_date: this.getOperationalDate(dateTime.toISO()),
233
+ operational_date_int: this.getOperationalDateInt(dateTime.toISO()),
220
234
  std_window: this.getStandardWindowInterval(dateTime.toISO()),
221
235
  unix_timestamp: dateTime.toMillis(),
222
236
  });
@@ -237,6 +251,7 @@ export class Dates {
237
251
  iso: dateTime.toISO(),
238
252
  js_date: dateTime.toJSDate(),
239
253
  operational_date: this.getOperationalDate(dateTime.toISO()),
254
+ operational_date_int: this.getOperationalDateInt(dateTime.toISO()),
240
255
  std_window: this.getStandardWindowInterval(dateTime.toISO()),
241
256
  unix_timestamp: dateTime.toMillis(),
242
257
  });
@@ -257,6 +272,7 @@ export class Dates {
257
272
  iso: dateTime.toISO(),
258
273
  js_date: dateTime.toJSDate(),
259
274
  operational_date: this.getOperationalDate(dateTime.toISO()),
275
+ operational_date_int: this.getOperationalDateInt(dateTime.toISO()),
260
276
  std_window: this.getStandardWindowInterval(dateTime.toISO()),
261
277
  unix_timestamp: dateTime.toMillis(),
262
278
  });
@@ -280,6 +296,7 @@ export class Dates {
280
296
  iso: dateTime.toISO(),
281
297
  js_date: dateTime.toJSDate(),
282
298
  operational_date: this.getOperationalDate(dateTime.toISO()),
299
+ operational_date_int: this.getOperationalDateInt(dateTime.toISO()),
283
300
  std_window: this.getStandardWindowInterval(dateTime.toISO()),
284
301
  unix_timestamp: dateTime.toMillis(),
285
302
  });
@@ -300,6 +317,7 @@ export class Dates {
300
317
  iso: dateTime.toISO(),
301
318
  js_date: dateTime.toJSDate(),
302
319
  operational_date: this.getOperationalDate(dateTime.toISO()),
320
+ operational_date_int: this.getOperationalDateInt(dateTime.toISO()),
303
321
  std_window: this.getStandardWindowInterval(dateTime.toISO()),
304
322
  unix_timestamp: dateTime.toMillis(),
305
323
  });
@@ -401,6 +419,9 @@ export class Dates {
401
419
  // Return the date as an operational date
402
420
  return operationalDate;
403
421
  }
422
+ getOperationalDateInt(isoDate) {
423
+ return Number(this.getOperationalDate(isoDate));
424
+ }
404
425
  /**
405
426
  * This function returns the start and end of the standard window interval for a given timestamp.
406
427
  * The standard window interval is the period in which is possible to receive data for a given ride.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/dates",
3
- "version": "20260618.2315.12",
3
+ "version": "20260620.940.32",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"