@beauraines/toggl-cli 2.3.9 → 2.3.10
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/utils.js +16 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.3.10](https://github.com/beauraines/toggl-cli/compare/v2.3.9...v2.3.10) (2024-08-08)
|
|
6
|
+
|
|
5
7
|
### [2.3.9](https://github.com/beauraines/toggl-cli/compare/v2.3.8...v2.3.9) (2024-07-23)
|
|
6
8
|
|
|
7
9
|
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -149,16 +149,24 @@ export const displayTimeEntry = async function (timeEntry) {
|
|
|
149
149
|
* @returns {object} dayjs object
|
|
150
150
|
*/
|
|
151
151
|
export function parseTime (timeString) {
|
|
152
|
-
let h, m
|
|
152
|
+
let h_orig, h, m
|
|
153
153
|
// Assumes time in format 4:50 PM
|
|
154
154
|
const time = timeString.split(':', 2)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
|
|
156
|
+
// + in front of string converts to a number, cool!
|
|
157
|
+
h_orig = +time[0]
|
|
158
|
+
m = +time[1].match(/[0-9]+/)[0]
|
|
159
|
+
|
|
160
|
+
if (h_orig > 12) {
|
|
161
|
+
// 24 hour time
|
|
162
|
+
h = h_orig
|
|
163
|
+
} else if (h_orig == 12) {
|
|
164
|
+
// 12 is a special case
|
|
165
|
+
h = timeString.match(/PM/i) ? 12 : 0
|
|
166
|
+
} else {
|
|
167
|
+
// 12 hour time
|
|
168
|
+
h = h_orig
|
|
169
|
+
if (timeString.match(/PM/i)) h += 12
|
|
162
170
|
}
|
|
163
171
|
return dayjs().hour(h).minute(m).second(0).millisecond(0)
|
|
164
172
|
}
|