Create an ical event using either POSIXct type or character type with format parameters.

ic_event(
  uid = ic_guid(),
  start_time = as.POSIXct(round.POSIXt(Sys.time(), units = "hours")),
  end_time = 1,
  format = "%Y-%m-%d %H:%M",
  summary = "ical event",
  more_properties = FALSE,
  event_properties = calendar::properties
)

Format

in case of start_time and end_time being character values, a format must be provided.

Arguments

uid

the unique id of the event, by default generated by ic_uid()

start_time

start time, by default the start time plus one hour

end_time

a number representing the number of hours after start_time or an datetime object (of class POSIXct) when the event ends. By default set to 1, meaning 1 hour after start_time.

format

required if start_time and end_time are vectors and are not of datetime format "%Y-%m-%d %H:%M", you can use calendar::formats object for convenience.

summary

short outline of the event

more_properties

add placeholder columns for properties in addition to properties_core, dy default FALSE

event_properties

named vector of additional properties to include. By default These include names stored in the data object properties (a packaged dataset), containing NAs to be subsequently populated.

Value

object of class ics

Examples

ic_event()
#> # A tibble: 1 × 4
#>   UID                            DTSTART             DTEND               SUMMARY
#>   <chr>                          <dttm>              <dttm>              <chr>  
#> 1 ical-6058ef88-8df2-4ee8-a186-… 2024-08-20 07:00:00 2024-08-20 08:00:00 ical e…
s <- lubridate::ymd_h("2019-01-01 00")
ic_event(start_time = s, end_time = 3)
#> # A tibble: 1 × 4
#>   UID                            DTSTART             DTEND               SUMMARY
#>   <chr>                          <dttm>              <dttm>              <chr>  
#> 1 ical-8d9bc2f4-09ef-42f8-839e-… 2019-01-01 00:00:00 2019-01-01 03:00:00 ical e…
# also accepts this format by default, thanks to lubridate::ymd_h:
ic_event(start_time = "2019-01-01 00")
#> # A tibble: 1 × 4
#>   UID                            DTSTART             DTEND               SUMMARY
#>   <chr>                          <dttm>              <dttm>              <chr>  
#> 1 ical-8be1a95c-5594-43cb-803c-… 2019-01-01 00:00:00 2019-01-01 01:00:00 ical e…
ic_event(more_properties = TRUE)
#> # A tibble: 1 × 4
#>   UID                            DTSTART             DTEND               SUMMARY
#>   <chr>                          <dttm>              <dttm>              <chr>  
#> 1 ical-5a05f23b-f053-45f7-ae0c-… 2024-08-20 07:00:00 2024-08-20 08:00:00 ical e…
ic_event(start_time = "18-10-12", end_time = "18-10-13", format = calendar::formats$`yy-mm-dd`)
#> # A tibble: 1 × 4
#>   UID                            DTSTART             DTEND               SUMMARY
#>   <chr>                          <dttm>              <dttm>              <chr>  
#> 1 ical-4ad001b1-2c24-46f6-b62e-… 2018-10-12 00:00:00 2018-10-13 00:00:00 ical e…