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.
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.
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.
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.