Aptivi - Manual
ProjectsWebsiteBlog
VisualCard - Manual
VisualCard - Manual
  • Welcome!
  • Breaking Changes
  • Usage
    • How to use
      • Card Parts
      • Calendar Parts
      • Property Management
      • Parsers
        • Recurrence Rules
        • Date/Time Tools
        • Durations and Periods
    • Extra Features
      • Card Conversion
      • Card Generation
      • Social Media URIs
      • QR Code Generation
    • How it works
  • Report an issue
  • Source code
  • API Reference
Powered by GitBook
On this page
Edit on GitHub
  1. Usage
  2. How to use
  3. Parsers

Durations and Periods

What's the duration or the period of the event?

Last updated 7 months ago

VisualCard offers a duration parser that allows you to parse a string representation of the duration as specified in the ISO-8601:2004 format. A single function that you can use is GetDurationSpan() from the vCardCommonTools class.

Once parsing is done, if the syntax is valid, it returns a tuple of both the DateTimeOffset that describes a resulting end date added to either a current date or a specified root date, and a TimeSpan that describes the processed duration.

For vCalendar 2.0, month and year specifiers are not supported, but vCalendar 1.0 does. You can review the duration specifier .

Periods describe a start date and an end date for a specific time ranged events, and can be described as a precise period of time. You can see its specification from the vCard 2.0 spec . GetTimePeriod() allows you to parse a period string and convert it to an appropriate TimePeriod class that has the following properties:

  • StartDate: A DateTimeOffset instance that contains an event start date

  • EndDate: A DateTimeOffset instance that contains an event end date

  • Duration: A TimeSpan instance that contains a computed duration of a time period

here
here