iCalendar UNTIL rule must be of the same type as DTSTART property? - standards

In iCalendar RFC 5545, section 3.3.10, I see the following UNTIL parameter description:
The value of the UNTIL rule part MUST have the same
value type as the "DTSTART" property. Furthermore, if the
"DTSTART" property is specified as a date with local time, then
the UNTIL rule part MUST also be specified as a date with local
time. If the "DTSTART" property is specified as a date with UTC
time or a date with local time and time zone reference, then the
UNTIL rule part MUST be specified as a date with UTC time.
However, in 3.8.5.3 Recurrence Rule paragraph, UNTIL is always specified in UTC, regrdless of DTSTART property:
DTSTART;TZID=America/New_York:19970902T090000
RRULE:FREQ=DAILY;UNTIL=19971224T000000Z
DTSTART;TZID=America/New_York:19970902T090000
RRULE:FREQ=WEEKLY;UNTIL=19971007T000000Z;WKST=SU;BYDAY=TU,TH
There are 5 of such examples in total.
I also found that at least 2 CalDAV clients (iOS and Mozilla Lightning) always submit UNTIL parameter in UTC, regardless of DTSTART property.
The only place where UNTIL must be always in UTC is RRULE in VTIMEZONE. Or am I not getting something?

The cited paragraph has three parts:
part 1
The value of the UNTIL rule part MUST have the same value type as the "DTSTART" property.
This refers to the value type i.e. VALUE=DATE vs. VALUE=DATE-TIME. If the event is an all-day event the UNTIL date has to be specified as an all-day date as well, otherwise the UNTIL date must have a time component.
part 2
Furthermore, if the "DTSTART" property is specified as a date with local time, then the UNTIL rule part MUST also be specified as a date with local time.
In this context "local time" means "floating time" as specified in Section 3.3.5 (Form #1), which says:
FORM #1: DATE WITH LOCAL TIME
The date with local time form is simply a DATE-TIME value that
does not contain the UTC designator nor does it reference a time
zone. For example, the following represents January 18, 1998, at
11 PM:
19980118T230000
DATE-TIME values of this type are said to be "floating" and are
not bound to any time zone in particular.
That also includes VALUE=DATE dates.
If DTSTART is floating, i.e. not anchored in any specific time zone, the UNTIL value can't be an absolute time, otherwise the actual end of the rule would depend on your current time zone.
As noted, this doesn't apply to RRULEs inside of VTIMEZONE definitions.
part 3
If the "DTSTART" property is specified as a date with UTC time or a date with local time and time zone reference, then the UNTIL rule part MUST be specified as a date with UTC time.
The key difference is that this sentence talks about an absolute DTSTART time, either in UTC or in local time with a time zone reference (like in the quoted examples).
This refers to Form #2 and Form #3 of Section 3.3.5. If the value of DTSTART corresponds to any of these forms, the UNTIL value has to be specified in UTC time. I think the reasoning behind that is that you don't need to specify a time zone for the UNTIL date if you use "zulu" notation (and you can not assume that you can use the time zone of DTSTART for UNTIL).
edit
Since "floating time" is not very common in calendar clients, you'll barely see any non-UTC UNTIL dates. In Thunderbird/Lightning you can explicitly select "Local Time" for an event, which creates a floating event. In that case you should get an UNTIL value in local time as well.

Related

How to add time to schema event type

My startDate looks like this 03-03-2020 but I need to add time as well. I have checked some example schema from other sources and have come across something similar:
2020-03-03T12:45:00+01:00
I have two concerns:
Does the time format matter? My format is dd-mm-YYYY. The second example format is different. Is there any problem having it either way?
How do you properly add the time time to the startDate property. Is the last extension the TimeZone e.g +03:00 or should you use the Universal Time zone then include your Timezone (Time offset).
Please help clarify.
I have two concerns: Does the time format matter? My format is
dd-mm-YYYY. The second example format is different. Is there any
problem having it either way?
If you check the description of the startDate property then there you will see the following information:
The start date and time of the item (in ISO 8601 date
format).
If you follow the specified link, then in the Wikipedia article (in the right panel) you can see the following time format:
Date 2020-03-04
In order to establish a machine-readable format, you can use an HTML element such as time with datetime.
======================================
How do you properly add the time time to the startDate property. Is
the last extension the TimeZone e.g +03:00 or should you use the
Universal Time zone then include your Timezone (Time offset).
Indicate time in ISO format with a time offset, e.g., if you are located in the Canadian province of Yukon then you can use a time zone indication such as 2020-03-04T05:16:15-08:00.
In Sweden, I have Central European Time with a time offset of +1 hour and summertime +2 hours. So at the moment in Sweden, I can use a time format such as 2020-03-04T05:22:16+01:00. However, the Sweden summertime will be in a format such as 2020-07-04T05:22:16+02:00

Is there a way to take a fixed date and change it into a date table in Lua without specifically assigning each value?

I have a date which is being fed into my script in the following format:
dateTime = "Fri Oct 18 10:08:02 UTC 2019"
Is there a way to reformat this so that I can quickly call each element as I like without explicitly splitting out using string.sub (for example)?
E.g. So that I can:
Subtract one date from another to find out age (using current time and birth/established date)
Add hours dependant on the timezone (given that I have a timezone in the format "+3")
Find if the time was between a range (e.g. the request was sent between 9am and 5pm GMT)
Lua does not have a built-in date or time type like other languages.
Lua 5.3 Reference Manual 2.1 Values and Types
There are eight basic types in Lua: nil, boolean, number, string,
function, userdata, thread, and table.
Lua 5.3 Reference Manual 6 Standard Libraries
Either implement them yourself or find existing modules that suit your needs.
A simple way would be to parse your date time string using captures
Checkout http://lua-users.org/wiki/DateAndTime for suggestions.

Set moment date after setting the utcOffset

I'm looking to set a date on the YYYYMMDD that should be referencing to a date on a specific utcOffset. But I'm not sure what would be the best and elegant way to set this date after setting the utcOffset.
The close I can get is the following but its not the actual result I want. I need a way to first set the offset and then set the YYYYMMDD based on this offset.
moment.utc(ymdDate, 'YYYYMMDD').utcOffset(timeOffset)
Example:
In case I had a date like 20190420 that must be used on a moment object that should be referring to a different timezone and I do the following the date would result in April 19th.
moment.utc(20190420, 'YYYYMMDD').utcOffset(-300).format()
Result:
2019-04-19T19:00:00-05:00
Expected Result:
2019-04-20T00:00:00-05:00
You can use utcOffset passing true as second parameter
The utcOffset function has an optional second parameter which accepts a boolean value indicating whether to keep the existing time of day.
Passing false (the default) will keep the same instant in Universal Time, but the local time will change.
Passing true will keep the same local time, but at the expense of choosing a different point in Universal Time.
Here a live sample:
console.log( moment.utc(20190420, 'YYYYMMDD').utcOffset(-300, true).format() );
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>

Issue with date checking

In Apex app I've a region called Person on a page. Inside a region there is a masked date picker. I have a task to validate the date of birth. So, the date of birth could not be less 1900 year. In "Conditions" section i'd been trying to write an pl/sql expression:
TRUNC(TO_DATE(:P1002_CONTR_BIRTH_DATE, 'MM-DD-YYYY')) > TO_DATE('01.01.1900', 'MM-DD-YYYY')
but it doesn't work. What am I doing wrong?
You put it to wrong place - "Condition" is used to decide whether an item will (or will not) be rendered on the screen.
Validation should be put into ... well, validation (obviously).
right-click the P1002_CONTR_BIRTH_DATE date picker item
choose "Create Validation"
set its type to "PL/SQL function (returning error text)
use such a code (presuming that you set the date picker format mask to MM-DD-YYYY):
if to_date(:P1002_CONTR_BIRTH_DATE, 'mm-dd-yyyy') < date '1900-01-01' then
return ('Error - can not set it to before 01-01-1900');
end if;
set it to fire when SUBMIT button is pressed
Alternatively (and way simpler) would be to open date picker item's property palette, navigate to its "Minimum date" property and put (for example) -120y in there which will allow dates that are higher than sysdate - 120 years (today, Apex would raise the
Birth date is less than specified minimum date 04-15-1898'
which isn't exactly "1900", but - you can easily calculate it, right? Also, -120y is somewhat more flexible than fixed year 1900.
Now you have two options, pick the one that suits you best.
TO_DATE() method is to convert a string to date, the string format should be the same as format_mask.
TRUNC(TO_DATE(:P1002_CONTR_BIRTH_DATE, 'MM-DD-YYYY')) > TO_DATE('01-01-1900', 'MM-DD-YYYY')
or
TRUNC(TO_DATE(:P1002_CONTR_BIRTH_DATE, 'MM-DD-YYYY')) > TO_DATE('01.01.1900', 'MM.DD.YYYY')
and also make sure :P1002_CONTR_BIRTH_DATE is also the same as format.
For detail

How to tell if moment date object date fragment value is implicit or explicit?

I am parsing a string that contains date in it and I want to know whether it contains a specific fragment of the date (e.g. year, month, etc).
I have looked into the documentation and into the resulting object, e.g.
In the above example, the subject input contains only information about day and month. Year value is derived from the current time.
Looking at the output/using moment API, how can I tell whether the year value is explicit (was parsed from the subject string using format) or implicit (moment assumes current new Date() value to fill in the gaps)?

Resources