Introduction
There has been an expressed need for the ability to use fractional seconds in iCalendar. With the advent of JSCalendar there is a way to do so in that representation. This specification provides a — partially backwards compatible - way to represent such times in iCalendar.
It is probable that applications needing fractional seconds require recurrence rules that use sub-second intervals.
This specification also shows how values should be mapped to and from JSCalendar.
iCalendar: Representing fractional seconds in iCalendar
1. Scope
This document specifies an extension to the Internet Calendaring and Scheduling Core Object Specification (iCalendar) to support fractional time values. It defines:
The format for expressing fractional time values in iCalendar properties
Rules for handling fractional time values in calendar operations
Compatibility considerations with existing iCalendar implementations
This specification is designed to be backward compatible with existing iCalendar implementations while providing enhanced precision where needed.
2. Normative references
The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.
IETF RFC 5545, B. DESRUISSEAUX (ed.). Internet Calendaring and Scheduling Core Object Specification (iCalendar). 2009. RFC Publisher. https://www.rfc-editor.org/info/rfc5545.
3. Terms and definitions
No terms and definitions are listed in this document.
4. New iCalendar parameters
4.1. FRACTIONAL parameter
Parameter name
FRACTIONAL
Purpose
This parameter is used to contain a value with fractional seconds for time values and durations.
Description
This parameter MAY be specified on properties of type DATE-TIME or DURATION. It MUST be a valid iCalendar DATE-TIME or DURATION value with the addition of fractional seconds. The value MUST NOT be negative for durations but MAY be negative for alarm triggers.
Applications receiving a property with a FRACTIONAL parameter MUST ensure its value is consistent with the value of the property. The property value must match:
a positive FRACTIONAL value rounded up to the next non-fractional second or
a negative FRACTIONAL value rounded down the next non-fractional second
If the values do not match the the application MUST assume that the property value has been updated by an application that is unaware of the FRACTIONAL parameter. The parameter should be ignored in this case.
Format Definition
This parameter is defined by the following notation:
fractional-param = DATE-TIME or DURATION
Example
DTSTART;FRACTIONAL=20190605T133015.03:20190605T133015
5. Obtaining a Property Value
If the property has a FRACTIONAL parameter first check that it is a valid value using the criteria specified in Clause 4.1. If valid, use that value for the iCalendar property.
If the property has no FRACTIONAL parameter or the value of that parameter is invalid then use the normal property value.
For example:
...
ESTIMATED-DURATION;FRACTIONAL="PT17H15M23.5S:PT18H
...
The value here is "PT18H" because the FRACTIONAL parameter is not valid.
...
ESTIMATED-DURATION:PT18H
...
The value here is "PT18H" because there is no FRACTIONAL parameter.
...
ESTIMATED-DURATION;FRACTIONAL="PT17H15M23.5S:PT17H15M24S
...
The value here is "PT17H15M23.5S" because the FRACTIONAL parameter is valid.
6. Mapping from iCalendar to JSCalendar
When mapping properties possibly containing time, use the iCalendar property value obtained as specified in Clause 5.
For example:
...
ESTIMATED-DURATION;FRACTIONAL="PT17H15M23.5S:PT18H
...
maps to
...
"estimatedDuration": "PT18H"
...
because the FRACTIONAL parameter is not valid.
...
ESTIMATED-DURATION:PT18H
...
maps to
...
"estimatedDuration": "PT18H"
...
and
...
ESTIMATED-DURATION;FRACTIONAL="PT17H15M23.5S:PT17H15M24S
...
maps to
...
"estimatedDuration": "PT17H15M23.5S"
...
because the FRACTIONAL parameter is valid.
7. Mapping from JSCalendar to iCalendar
If the JSCalendar property value has fractional seconds then the IETF RFC 5545 value is set to the JSCalendar property value rounded up to the next non-fractional value and a FRACTIONAL parameter is added with the full unrounded value.
For example:
...
"duration": "PT0.5S"
...
maps to
...
DURATION;FRACTIONAL="PT0.5S":PT1S
...
and
...
"duration": "PT1H"
...
maps to
...
DURATION:PT1H
...