Read the statement by Michael Teeuw here.
Calendar showing "in X day" wrongly
-
I started configuring and testing MMM a couple of days ago. I set it up with a couple of calendars, my facebook birthday feed for instance. For some reason it’s showing for example “in one day” when it’s really in two days. It’s shows “Tomorrow” correctly,
so let’s say today is the 8th. I have one friends birthday on the 9th and one on the 10th. On the one that’s having birthday tomorrow it says tomorrow but on the one having her birthday on the 10th it says “in one day” even though it’s really two days. The exact same thing happend on the 7th when it showed the person having her birthday on the 9th it said “in one day”
I thought it might’ve been something with the Swedish translation on the mod but I changed to english now and it’s the same issue. Could it be something about the time zone?
EDIT: I just checked the timezone in raspi-config and it’s the right one CET (GMT+1)
-
@creepwood It’s possible that the script library counts in a more literal fashion than people do. In your example, your friend’s birthday on the 10th is “in two days” as people describe it. But it’s technically less than 48 hours. That might make the calculations get weird.
[shrug] It’s a theory.
-
@bhepler is correct here. It calculates based on midnight. It’s in “one day” starting at “the next closest midnight”. That’s simply the way moment.js calculates time.
-
@KirAsh4 I agree with OP that this is an unnatural way of counting days for humans.
Wouldn’t it be possible to do different calculations based on if it’s more or less that 24 hours?
-
So crassly speaking, the module isn’t really working correctly.
There are different ways to calculate it with the right result, it just depends on how you want to do it. I’m just surprised that it isn’t already working like that, I can’t be the only one finding this an issue.
-
Guys, please read what I said above: it’s the way Moment.js calculates time. The actual module does not do any kind of time calculations, it simply passes the information to and from Moment.js.
If you want the calculations to be done different, then please write a new module, using a different library, and submit a PR request. All of MagicMirror uses the Moment.js library, for any kind of time calculations.
-
If you want the calculations to be done different,
I’m adamant that however you turn and twist this argument. it’s not “different” it’s incorrect. “tomorrow” and “in 1 day” means the same thing. If MMM says it isn’t, MMM is wrong.
-
@creepwood If you’re not happy with the way the module calculates the dates, you’re welcome to write your own.
See, this way it’s not an argument. It’s a suggestion.
-
I’m not a dev, but a workmate shows me the followed video about development and timezone(s), since then - I never mess with a dev about this thing again - Maybe it helps you to understand that those thins “aren’t just easy” as we think from our point of view :).
https://www.youtube.com/watch?v=-5wpm-gesOY
Have fun, its a nice insight.
-
@tajno I don’t develop professionally any more but I’m aware of the issue with timezones but this should not be a big deal and from what I understand the MMM dev is Netherlander which is the same timezone as I’m in.
I’m baffled that nobody else seem to think this is an issue when it says in x day when it actually seem to mean x + 1 day.