Problem/Motivation
I have events which, for example, are on Daily from January 11th to January 15th inclusive, 10am to 4pm and I am struggling to get the output of this to work the way we hope. Ideally we would want to have Monday 11 January 2021 - Friday 15 January 2021 10am - 4pm. I have tried the Recurring smart date format however to get it to include the 15th the rule actually goes to the 16th and so the Rule which appears says "Daily at 10am until Saturday 16 January 2021" and when I output the time separately to get "10am to 4pm" it repeats for every instance.
Could someone point me in the right direction to alter the format of these? I am happy to code, just want to make sure I do it the right way but also make sure I just haven't missed something in the UI.
I am considering just having the date range Monday 11 January 2021 10am - Friday 15 January 2021 4pm for now but ideally we would be able to separate it out. Unless this is the way to do it?
Comment | File | Size | Author |
---|---|---|---|
#5 | smart_date-daily_range-3172866-5.patch | 5.2 KB | mandclu |
Comments
Comment #2
mandclu CreditAttribution: mandclu at Northern Commerce commentedInteresting issue. Smart Date's standard formatter has separate handling for time and date ranges, so it sounds like what you want is to use both.
You would need to reduce the instances back to their rule, as is already done in the recurring formatter. Then you could determine your time and date ranges, and use the formatting functions which I believe reside in SmartDateTrait.
I like the idea of a compact way of listing daily events. Is there similar formatting we could do for weekly, monthly, and annual events? If so, maybe this could be a new formatter, or possibly even an option in the standard formatter.
Comment #3
MrPaulDriver CreditAttribution: MrPaulDriver commentedI had a very similar requirement for an event spanning 2 days and running between 10am and 5pm.
The best way I found for inclusion in a calendar was to create a daily event which ends after 2 repeats.
A downside to this approach when used with the recurring formatter, was a confusing repeat rule on the frontend, as quoted below.
Comment #4
mandclu CreditAttribution: mandclu at Northern Commerce commentedHere's a first stab at a patch for this. Also including a couple of screen captures, to illustrate that the approach seems to work better with some formats than others.
Comment #5
mandclu CreditAttribution: mandclu at Northern Commerce commentedUpdated patch to fix an an issue with the date vs time ordering
Comment #6
tisteegz CreditAttribution: tisteegz commentedThis seems to be working great for me! Will keep an eye out for the different date formats I add and make sure it works with them all.
Comment #7
MrPaulDriver CreditAttribution: MrPaulDriver commentedThe patch works well for repeats with a defined end date. But it doesn't yet improve the rule display for dates which end after (number) of times.
Fortunately, the same treatment could applied.
Existing: Daily at 9:00am for 5 times
Becomes: Daily at 9.00am - Mon, Oct 5 - Fri, Oct 9 2020
Or perhaps better: Daily at 9.00am - Mon, Oct 5 - Fri, Oct 9 2020 (6 times)
Could a config option be provided for 'times' ? It's a bit nondescript - this would open the way for stuff like; sessions, occasions, sittings, lessons, performances, days, nights etc.
Comment #8
mandclu CreditAttribution: mandclu at Northern Commerce commented@MrPaulDriver what you're suggesting sounds like a somewhat different request. Moving that discussion to #3174552: Option to configure label for "times" in Recurring formatter and marking this as RTBC based on previous feedback, but feel free to change it if additional work is needed on this new formatter.
Comment #9
MrPaulDriver CreditAttribution: MrPaulDriver commentedwithdrawn. dupe
Comment #11
mandclu CreditAttribution: mandclu at Northern Commerce commentedMerged in so closing this for now. Please create a child issue if there are additional ways this formatter could reduce duplication.