Calendar event dates enhancement
This is a request that was made by djsunrise19 on GitHub which i will quote below:
Hi, today I've seen another behavior. I had an event at 16 o'clock. I looked on both (MM1 and MM2) mirrors at 15 o'clock: MM1: displays in 1 hour or in 45 minutes (of course, 15minutes later) MM²: displays today at 16 o'clock Is it possible to put this function from MM1 in your MM² app? I know that is a personal feature. But in my opinion the MM1 solution fits way better. So you realize that the event is in the near future. Perhaps we can make that configurable.
This is my current take on it. I added a
timeFormatconfig option that allows you to set it to
'relative'. When set to
'relative'the time display will look like this:
'absolute'format, it looks like this:
The current code already checks whether an event is happening within the next 48 hours and translates the event time into ‘TODAY at’ or ‘TOMORROW at’. I added another check to see if an event it within the next 6 hours, which will change the time format to ‘in x hours’ which will count down till the event happens:
This is all currently being worked on locally on my fork. Once done I’ll submit a pull request. But I’d like to get feedback from others (as well as from djsunrise19 who originally requested this.) I’d like to know what other enhancements/changes people would like to see.
One thing for me is how I like things displayed. I like the relative time, but only up to a point. For example, if I see an event that says ‘in 2 days’, that will get my attention versus if it said ‘May 4th’. Simply because I may not know what the current date is and see the absolute date won’t mean much. However, at the same time, an event that’s happening 20 days from now, I don’t need it to say ‘in 20 days’. I’m perfectly happy with it saying ‘May 22nd’ on that. So i may add another option, maybe call it
'urgency'and allow it to be configurable to what one would want. For me that would be a week, so that any event happening within a week, it would say ‘in x days’ where everything else further away would display the absolute date. It’s a combination of having both absolute as well as relative dates displayed. That’s just my preference though.
Some day someone is going to have to explain to me how Moment.js thinks that Mother’s Day is 5 days from today. I’m sure it’s semantics, but the way I see it, today is May 2nd, add 5 days it’s May 7th. That’s not Mother’s Day … Mother’s day is on May 8th. I wonder if it’s saying 5 days because it’s less than 6 days TILL the 8th (like 5 days + 8.5 hours). I think it should just say ‘in 6 days’ and ignore calculating whether it needs to round up or down based on how many hours are left in the current day …
Adding my idea for an
'urgency'threshold for events, this is what it would look like:
MichMich last edited by
I agree that there are many (configurable) possibilities on the way event dates are displayed. And what I’ve learned in the past two years, is that there isn’t one way everybody thinks it works like it should …
More importantly, the Calendar module turns out to be the most difficult module to make bug free, since so many differences in the calendar feed appear to mess up the date calculation. Most of the current bug reports are about the calendar module. So it might be a good Idea to first work out these bugs, before we make the calendar module even more difficult.
Any help with regards to bug solving (in the form of pull requests) are more than welcome!
Correct, there will never be that one perfect solution for everyone, however that’s what I like about adding in configurable options so each person can do it their own way.
As for the problems, my take on that is that one will always have bugs crop up. Technology changes, web sites will rewrite their code that we might rely on, there won’t ever be a time where you write something once and never ever change it again. Eventually Time will catch up and something has changed, forcing you to do the same.
My suggestion is to do what’s possible, fix what’s easily fixable (including some of the easy requests), release the thing. Let future bugs be exactly that: future bugs. Address them as they come up.
Hey @djsunrise19, since you’re here now, would you mind commenting on these enhancements?
djsunrise19 last edited by
Hi @KirAsh4 , yes, since a frew hours, I’m here ;). I like your suggestion very much (
'urgency'. In my opinion the
'relative'format was the way how it was designed on the MM1!
MichMich last edited by
Any pull request in making this work would be welcome.
Yep, when I’m done cleaning it up. I have this thing against repeating blocks of code, which I had to do here, once for an all day event and again for a timed one. So let me rewrite it first and clean it up.
This isn’t a bug per se, I just happen to notice it. So my setup consists of an rPi-3 running MM2 on a screen that sits on my desk, next to my main monitor pair (I actually have 5 monitors on my desk if you count the laptop as well). Anyway, I don’t generally touch the main MM2 display on the rPi unless I have to. Now on my main system, I run MM2 in a browser by hitting the rPi’s MM 2port. This allows me to make changes to the code, reload it in the browser, and then compare the output from one screen to the other (on the rPi which has not been reloaded with the changes yet.) This works great …
Well, today this caught my attention:
Both those birthdays happen on that day (in fact, there are three of them.) So I made a change in my config to show more events so I can see all three birthdates. And for some reason, the sorting is different on the rPi versus the remote browser window.