@garmin/fitsdk 21.168.0 → 21.170.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.
package/src/utils.js CHANGED
@@ -1,66 +1,46 @@
1
- /////////////////////////////////////////////////////////////////////////////////////////////
2
- // Copyright 2025 Garmin International, Inc.
3
- // Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
4
- // may not use this file except in compliance with the Flexible and Interoperable Data
5
- // Transfer (FIT) Protocol License.
6
- /////////////////////////////////////////////////////////////////////////////////////////////
7
- // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.168.0Release
9
- // Tag = production/release/21.168.0-0-gb831b31
10
- /////////////////////////////////////////////////////////////////////////////////////////////
11
-
12
-
13
- /**
14
- * The millisecond offset between UNIX and FIT Epochs (631065600000).
15
- * @const {number}
16
- */
17
- const FIT_EPOCH_MS = 631065600000;
18
-
19
- /**
20
- * Convert a FIT DateTime to a JavaScript Date
21
- * @param {number} datetime - Seconds since FIT EPOCH
22
- * @returns {Date} A JavaScript Date object
23
- */
24
- const convertDateTimeToDate = (datetime) => {
25
- return new Date((datetime ?? 0) * 1000 + FIT_EPOCH_MS);
26
- };
27
-
28
- /**
29
- * Convert a JavaScript Date to a FIT DateTime
30
- * @param {Date} A JavaScript Date object
31
- * @return {number} datetime - Seconds since FIT EPOCH
32
- */
33
- const convertDateToDateTime = (date) => {
34
- return (date.getTime() - FIT_EPOCH_MS) / 1000;
35
- };
36
-
37
-
38
- /**
39
- * FIT Base Type enum, for use with Developer Data Field Descriptions
40
- */
41
- const FitBaseType = Object.freeze({
42
- enum: 0,
43
- sint8: 1,
44
- uint8: 2,
45
- sint16: 131,
46
- uint16: 132,
47
- sint32: 133,
48
- uint32: 134,
49
- string: 7,
50
- float32: 136,
51
- float64: 137,
52
- uint8z: 10,
53
- uint16z: 139,
54
- uint32z: 140,
55
- byte: 13,
56
- sint64: 142,
57
- uint64: 143,
58
- uint64z: 144,
59
- });
60
-
61
- export default {
62
- FIT_EPOCH_MS,
63
- convertDateTimeToDate,
64
- convertDateToDateTime,
65
- FitBaseType,
66
- };
1
+ /////////////////////////////////////////////////////////////////////////////////////////////
2
+ // Copyright 2025 Garmin International, Inc.
3
+ // Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
4
+ // may not use this file except in compliance with the Flexible and Interoperable Data
5
+ // Transfer (FIT) Protocol License.
6
+ /////////////////////////////////////////////////////////////////////////////////////////////
7
+ // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
+ // Profile Version = 21.170.0Release
9
+ // Tag = production/release/21.170.0-0-g5991e72
10
+ /////////////////////////////////////////////////////////////////////////////////////////////
11
+
12
+
13
+ import FIT from "./fit.js";
14
+
15
+ /**
16
+ * The millisecond offset between UNIX and FIT Epochs (631065600000).
17
+ * @const {number}
18
+ */
19
+ const FIT_EPOCH_MS = 631065600000;
20
+
21
+ /**
22
+ * Convert a FIT DateTime to a JavaScript Date
23
+ * @param {number} datetime - Seconds since FIT EPOCH
24
+ * @returns {Date} A JavaScript Date object
25
+ */
26
+ const convertDateTimeToDate = (datetime) => {
27
+ return new Date((datetime ?? 0) * 1000 + FIT_EPOCH_MS);
28
+ };
29
+
30
+ /**
31
+ * Convert a JavaScript Date to a FIT DateTime
32
+ * @param {Date} A JavaScript Date object
33
+ * @return {number} datetime - Seconds since FIT EPOCH
34
+ */
35
+ const convertDateToDateTime = (date) => {
36
+ return (date.getTime() - FIT_EPOCH_MS) / 1000;
37
+ };
38
+
39
+ export default {
40
+ FIT_EPOCH_MS,
41
+ convertDateTimeToDate,
42
+ convertDateToDateTime,
43
+ FitBaseType: FIT.BaseType,
44
+ BaseTypeToFieldType: FIT.BaseTypeToFieldType,
45
+ FieldTypeToBaseType: FIT.FieldTypeToBaseType,
46
+ };