@bobfrankston/gcal 0.1.7 → 0.1.8
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/gcal.ts +1 -0
- package/glib/gutils.ts +20 -0
- package/package.json +3 -2
package/gcal.ts
CHANGED
|
@@ -247,6 +247,7 @@ Examples:
|
|
|
247
247
|
gcal add "Dentist" "Friday 3pm" "1h"
|
|
248
248
|
gcal add "Lunch" "1/14/2026 12:00" "1h"
|
|
249
249
|
gcal add "Meeting" "tomorrow 10:00"
|
|
250
|
+
gcal add "Appointment" "jan 15 2pm"
|
|
250
251
|
gcal -defaultUser bob@gmail.com Set default user
|
|
251
252
|
|
|
252
253
|
File Association (Windows):
|
package/glib/gutils.ts
CHANGED
|
@@ -259,6 +259,26 @@ export function parseDateTime(input: string): Date {
|
|
|
259
259
|
return d;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
+
// Handle month names: "jan 15", "jan 15 2026", "jan 15 3pm", "january 15 2026 3pm"
|
|
263
|
+
const months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
|
264
|
+
const monthMatch = lower.match(/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\s+(\d{1,2})(?:\s+(\d{4}))?(?:\s+(?:at\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?)?$/i);
|
|
265
|
+
if (monthMatch) {
|
|
266
|
+
const [, month, day, year, hour, min, ampm] = monthMatch;
|
|
267
|
+
const monthIndex = months.findIndex(m => month.toLowerCase().startsWith(m));
|
|
268
|
+
const d = new Date(parseInt(year || now.getFullYear().toString()), monthIndex, parseInt(day));
|
|
269
|
+
if (hour) {
|
|
270
|
+
let h = parseInt(hour);
|
|
271
|
+
if (ampm?.toLowerCase() === 'pm' && h < 12) h += 12;
|
|
272
|
+
if (ampm?.toLowerCase() === 'am' && h === 12) h = 0;
|
|
273
|
+
d.setHours(h, parseInt(min || '0'), 0, 0);
|
|
274
|
+
} else {
|
|
275
|
+
d.setHours(0, 0, 0, 0);
|
|
276
|
+
}
|
|
277
|
+
if (!isNaN(d.getTime())) {
|
|
278
|
+
return d;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
262
282
|
// Handle explicit date/time formats: "MM/DD/YYYY HH:mm" or "YYYY-MM-DD HH:mm"
|
|
263
283
|
const dateTimeMatch = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(\d{1,2}):(\d{2})$/);
|
|
264
284
|
if (dateTimeMatch) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/gcal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Google Calendar CLI tool with ICS import support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "gcal.ts",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"preversion": "npm run check && git add -A",
|
|
24
24
|
"postversion": "git push && git push --tags",
|
|
25
25
|
"release": "npm run prerelease:local && npm version patch && npm publish --access public",
|
|
26
|
-
"release:local": "npm run prerelease:local && npm version patch && npm publish --access public --ignore-scripts"
|
|
26
|
+
"release:local": "npm run prerelease:local && npm version patch && npm publish --access public --ignore-scripts",
|
|
27
|
+
"installer": "npm run release && npm install -g ."
|
|
27
28
|
},
|
|
28
29
|
"keywords": [
|
|
29
30
|
"google",
|