@bobfrankston/gcal 0.1.6 → 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 CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  /**
3
3
  * gcal - Google Calendar CLI tool
4
4
  * Manage Google Calendar events with ICS import support
@@ -242,10 +242,13 @@ Options:
242
242
  -v, -verbose Show event IDs and links
243
243
 
244
244
  Examples:
245
- gcal meeting.ics Import ICS file
246
- gcal list List next 10 events
245
+ gcal meeting.ics Import ICS file
246
+ gcal list List next 10 events
247
247
  gcal add "Dentist" "Friday 3pm" "1h"
248
- gcal -defaultUser bob@gmail.com Set default user
248
+ gcal add "Lunch" "1/14/2026 12:00" "1h"
249
+ gcal add "Meeting" "tomorrow 10:00"
250
+ gcal add "Appointment" "jan 15 2pm"
251
+ gcal -defaultUser bob@gmail.com Set default user
249
252
 
250
253
  File Association (Windows):
251
254
  assoc .ics=icsfile
package/glib/gutils.ts CHANGED
@@ -259,6 +259,54 @@ 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
+
282
+ // Handle explicit date/time formats: "MM/DD/YYYY HH:mm" or "YYYY-MM-DD HH:mm"
283
+ const dateTimeMatch = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(\d{1,2}):(\d{2})$/);
284
+ if (dateTimeMatch) {
285
+ const [, month, day, year, hour, min] = dateTimeMatch;
286
+ const d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(min));
287
+ if (!isNaN(d.getTime())) {
288
+ return d;
289
+ }
290
+ }
291
+
292
+ const isoDateTimeMatch = input.match(/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{2})$/);
293
+ if (isoDateTimeMatch) {
294
+ const [, year, month, day, hour, min] = isoDateTimeMatch;
295
+ const d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(min));
296
+ if (!isNaN(d.getTime())) {
297
+ return d;
298
+ }
299
+ }
300
+
301
+ // Handle time only (HH:mm) - assume today
302
+ const timeMatch = input.match(/^(\d{1,2}):(\d{2})$/);
303
+ if (timeMatch) {
304
+ const [, hour, min] = timeMatch;
305
+ const d = new Date(now);
306
+ d.setHours(parseInt(hour), parseInt(min), 0, 0);
307
+ return d;
308
+ }
309
+
262
310
  // Try native Date parsing
263
311
  const parsed = new Date(input);
264
312
  if (!isNaN(parsed.getTime())) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/gcal",
3
- "version": "0.1.6",
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",