Unbounded Daterangepicker - datepicker

I want to build a form that includes a time range, specifically a period of validity. My tech stack is Angular with Bootstrap, so using something like the NgxBootstrap daterangepicker would be nice.
Now the problem is that validity periods may be bounded or unbounded, i.e. in addition to bounded periods like from 01.01.2019 till 31.01.2019 it should also be possible to define unbounded periods like from 01.01.2019 (without an end date).
Can this be properly done with a daterangepicker like the one from NgxBootstrap, or should I resort to two separate datepickers (one of them being nullable)?

Related

Use of BETWEEN with timestamps in PostgreSQL

I've stumbled on this page in PostgreSQL wiki, where it's advised to not use BETWEEN with timestamps:
Why not?
BETWEEN uses a closed-interval comparison: the values of both ends of
the specified range are included in the result.
This is a particular problem with queries of the form
SELECT * FROM blah WHERE timestampcol BETWEEN '2018-06-01' AND
'2018-06-08'
This will include results where the timestamp is exactly 2018-06-08
00:00:00.000000, but not timestamps later in that same day. So the
query might seem to work, but as soon as you get an entry exactly on
midnight, you'll end up double-counting it.
Can anyone explain how this "double-counting" can occur?
Often when using BETWEEN, you want to use multiple ranges (in separate queries) which cumulatively cover all the data.
If the next invocation of your query uses BETWEEN '2018-06-08' AND '2018-06-015', then exact midnight of 2018-06-08 will be included in both invocations. On the other hand, if the next one uses BETWEEN '2018-06-09' AND '2018-06-015', then all of 2018-06-08 except for exact midnight has been overlooked. There is no easy way (using BETWEEN) to construct ranges which cover every data point once and only once.

Recurring exceptions in ICal

Problem
Some reoccurring events, that don't really end at some point (like club meetings?), depend on other conditions (like holiday season). However, manually adding these exceptions would be necessary every year, as the dates might differ.
Research
I have found out about exdate (see the image of "iCalendar components and their properties" on Wikipedia (2))
Also found some possible workaround: 'just writing a script to do process such events'. This would still mean I need to process a .ics manually and import it into my calendar, which implies some limitations:
can not be determined for all time spans (e.g. holidays not fixed for more than three years)
these events would probably be separate and not reoccurring/'grouped', which makes further edits harder
Question
Is there a way to specify recurring exceptions in iCal ?
To clarify, I have a recurring event and recurring exceptions.
So for instance I have a infinitely reoccurring weekly event, that depends on the month; where it might only take place if it's not e.g. January, August, or December.
Is there a way to use another event (/calendar) to filter events by boolean logic ?
If one could use a second event (or several) to plug into exdate this would solve the first problem and add some more possibilities.
note
if this question is too specific and the original problem could be solved by other means (other calendar-formats), feel free to comment/edit/answer
RFC2445 defines an EXRULE (exception rule) property. You can use that in addition to the RRULE to define recurring exceptions.
However, RFC2445 was superseded by RFC5545, which unfortunately deprecates the EXRULE property. So, client support is questionable.
As you already proposed, automatically adding EXDATE properties is a possible solution.
BYMONTH would be another possibility, e.g. here's a rule for a club meeting that occurs the first Wednesday of every month except December (which is their Christmas party, so no business meeting)
RRULE:FREQ=MONTHLY;BYDAY=1WE;BYMONTH=1,2,3,4,5,6,7,8,9,10,11

Tableau software - Is it possible to hide a parameter depending on the value of another parameter?

I have a dashboard with three displayed parameters:
Time range (Last month, This month, Last 30 days, ..., custom interval)
From (the begin date of the interval)
To (ending date of interval)
My point is that I want to display "From" and "To" parameters only in case when "Time range" parameter is equal to "Custom interval".
Otherwise, i want to hide them, or make them impossible to edit.
Could you help me with this please ?
Thanks.
There are a handful of techniques for selectively hiding components on a dashboard, informally called "sheet swapping".
One simple approach is to place a floating worksheet in a layer above the components you wish to hide -- and make that worksheet have filters based on calculated fields that lead to zero rows or columns being displayed when you wish to show the components below. Then if you hide the title on the worksheet, it will display as zero pixels high or as its complete height depending on the parameter settings.
Here is an example of that approach https://public.tableau.com/en-us/s/gallery/music-uk
Another form of sheet swapping that gives you a little more flexibility is to place the components that wish to selectively display inside a layout container along with a component whose size depends on the parameter setting. Then you can adjust the "fit" options for the worksheets and where and how you place the layout container to make the optional controls slide in and out of the dashboard, or slide beneath or out from under a floating component.
Joshua Milligan published a workbook demonstrating some of these techniques http://public.tableau.com/views/SheetSwappingonSteroids/PracticalExample and he also describes them in his (highly recommended) book Learning Tableau 10
Robert Rouse also published a blog entry showing some fancier sheet swapping techniques https://www.tableau.com/about/blog/2016/1/how-create-collapsible-menu-container-tableau-48610
Note, sheet swapping puts a bit of unnecessary load on the Tableau server if overdone (computing layout positions for views that won't be displayed anyway).
If you don't mind a bit of coding, another option is to embed your visualizations within an HTML page of your own design. Then you can use all the power of HTML and CSS to style parts of your UI - including hiding and showing input controls. Then write a bit of JavaScript using Tableau's JavaScript API to let Tableau know when someone updates an HTML control so it can update the visualization in response. For a really robust complex page, that might be a better choice than trying to emulate HTML/CSS with sheet swapping techniques in a Tableau workbook.

iCal rrule for two different lengths

I want to enter an event in my calendar that runs on Monday and Tuesdays from 8-3 and Saturdays from 8-12 every week. My app is supporting rrule's. Is it possible to pack that into a single rrule?
If it would be only the weekdays, then the rule would be simple and do look like:
FREQ=WEEKLY;BYDAY=MO,TU
Any hints are appreciated.
The duration of the event is not part of the rrule definition but is rather determined by the DTSTART/DTEND or DTSTART/DURATION combinations so there is no way to have one single event representing what you want (unless you create exceptions for every single instances on Saturday)
The best you can do is to use the RELATED-TO property (https://www.rfc-editor.org/rfc/rfc5545#section-3.8.4.5) to link the 2 events.

iCalendar recurrence rule for event that occurs every two years in multiple months on first weekend day

Is it possible to specify an event to occur on the 1st weekend day of multiple months every 2 years in a single RRULE? Using February and September as a test case, my first thought was:
FREQ=YEARLY;DTSTART=20140320T070000Z;INTERVAL=2;BYSETPOS=1;BYMONTH=2,9;BYDAY=SA,SU
but BYSETPOS reduces the set down to February only. I thought changing the freq to monthly would do the trick after I posted here, but applying an interval of 2 for every other year messes things up because the interval is applied to a monthly freq instead of a yearly freq.
I made this a new question because I did not include interval in my original question.
I think splitting this into multiple rrules would work, but it would greatly increase the complexity of this area of my app so I was hoping for a single rrule with a yearly freq.
Thanks!
FWIW, and since you mention it as a potential workaround, RFC5545 has removed the ability to have multiple RRULE property in a single VEVENT/VTODO (https://www.rfc-editor.org/rfc/rfc5545#section-3.6.1). It was there in RFC2445.
Then, unless someone finds a very elegant and simple solution, you may be left with something that is so convoluted that most clients will barf on it (don't know how interoperability is important to you).
This leaves you with 2 choices I think:
either use 2 different events (maybe linked with a RELATED-TO property)
or, if you can bound the event to a certain number of instances, represent it as a set of RDATE (or RRULE + RDATE, or RRULE + EXDATE, etc...).
Adding BYSETPOS like this may work as you intend:
FREQ=YEARLY;INTERVAL=2;BYMONTH=2,9;BYDAY=+1SA,+1SU;BYSETPOS=1,3
what you could try is to take advantage of the fact that bysetpos allows you to select within the year the selected instances of your rule, then you could limit the number of instances to the first week of the month (by setting the days of the month to the first 6 ones) to avoid the cases where month have more or less weeks, which then allows you to select the first and third instance in your year.
Which then gives:
DTSTART:20140320T060000Z
FREQ=YEARLY;INTERVAL=2;WKST=MO;BYSETPOS=1,3;BYMONTH=2,9;BYMONTHDAY=1,2,3,4,5,6,7;BYDAY=SA,SU
which will be:
Sat 2014/Sept/6
Sat 2016/Feb/6
Sat 2016/Sep/3
...
Sun 2024/Sep/1
this was verified with dateutil-python and http://jkbr.github.io/,