@bobfrankston/gcal 0.1.6 → 0.1.7

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,12 @@ 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 -defaultUser bob@gmail.com Set default user
249
251
 
250
252
  File Association (Windows):
251
253
  assoc .ics=icsfile
package/glib/gutils.ts CHANGED
@@ -259,6 +259,34 @@ export function parseDateTime(input: string): Date {
259
259
  return d;
260
260
  }
261
261
 
262
+ // Handle explicit date/time formats: "MM/DD/YYYY HH:mm" or "YYYY-MM-DD HH:mm"
263
+ const dateTimeMatch = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(\d{1,2}):(\d{2})$/);
264
+ if (dateTimeMatch) {
265
+ const [, month, day, year, hour, min] = dateTimeMatch;
266
+ const d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(min));
267
+ if (!isNaN(d.getTime())) {
268
+ return d;
269
+ }
270
+ }
271
+
272
+ const isoDateTimeMatch = input.match(/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{2})$/);
273
+ if (isoDateTimeMatch) {
274
+ const [, year, month, day, hour, min] = isoDateTimeMatch;
275
+ const d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(min));
276
+ if (!isNaN(d.getTime())) {
277
+ return d;
278
+ }
279
+ }
280
+
281
+ // Handle time only (HH:mm) - assume today
282
+ const timeMatch = input.match(/^(\d{1,2}):(\d{2})$/);
283
+ if (timeMatch) {
284
+ const [, hour, min] = timeMatch;
285
+ const d = new Date(now);
286
+ d.setHours(parseInt(hour), parseInt(min), 0, 0);
287
+ return d;
288
+ }
289
+
262
290
  // Try native Date parsing
263
291
  const parsed = new Date(input);
264
292
  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.7",
4
4
  "description": "Google Calendar CLI tool with ICS import support",
5
5
  "type": "module",
6
6
  "main": "gcal.ts",