2

Is it possible to create a QR Code that sets up an event in the calendar with a date that is relative to the date the code is scanned?

Example: Scan code and 2 months from today, my phone shows an event or provides me with a reminder alert.

Peter O.
  • 32,158
  • 14
  • 82
  • 96

2 Answers2

1

You can create a QR Code that's pointing an url where is located an .ics file. One time that the file is downloaded a pop-up appears on the device, setting up the event.

You can create custom .ics file, for example, here: http://www.pratie.com/lab/icalendar/

EDIT: you can compile dynamically the DSTART variable in your code programming:

BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20121121T090000
DTEND:20121121T100000
SUMMARY:fdsf
LOCATION:
DESCRIPTION:
PRIORITY:3
END:VEVENT
END:VCALENDAR

The format of variable DSTART is the following:

DSTART: <year><month><day>T<hour><minutes><seconds>

To use a relative "now" time you can use the multiple options that programming gives. (Time.now, timestamp), and then convert it to correct .ics output.

damoiser
  • 6,058
  • 3
  • 40
  • 66
  • The OP is already referring to iCal format, used in .ics. This doesn't suggest how you would write a DSTART property that is relative to 'now'. – Sean Owen Nov 21 '12 at 21:57
1

Icalendar spec (RFC5545) does not allow the DTSTART to be relative:

3.8.2.4.  Date-Time Start [...] The time value MUST be one of the forms defined for the DATE-TIME value type. The value type can be set to a DATE value type.

3.3.4.  Date [...] The textual format specifies a four-digit year, two-digit month, and two-digit day of the month.

3.3.5.  Date-Time [...] The "DATE-TIME" value type is used to identify values that contain
  a precise calendar date and time of day.

However the QRCODE could be a link to a url which would then dynamically generate a ical file with a DTSART which would be set to the date 2months in the future.

Auberon Vacher
  • 4,655
  • 1
  • 24
  • 36