MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Calendar showing "in X day" wrongly

    Scheduled Pinned Locked Moved Troubleshooting
    20 Posts 6 Posters 14.9k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      creepwood
      last edited by creepwood

      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)

      bheplerB 1 Reply Last reply Reply Quote 0
      • bheplerB Offline
        bhepler Module Developer @creepwood
        last edited by

        @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.

        1 Reply Last reply Reply Quote 0
        • KirAsh4K Offline
          KirAsh4 Moderator
          last edited by

          @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.

          A Life? Cool! Where can I download one of those from?

          CatoC C 2 Replies Last reply Reply Quote 0
          • CatoC Offline
            Cato Module Developer @KirAsh4
            last edited by Cato

            @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?

            1 Reply Last reply Reply Quote 1
            • C Offline
              creepwood @KirAsh4
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • KirAsh4K Offline
                KirAsh4 Moderator
                last edited by

                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.

                A Life? Cool! Where can I download one of those from?

                C 1 Reply Last reply Reply Quote 1
                • C Offline
                  creepwood @KirAsh4
                  last edited by

                  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.

                  bheplerB T 2 Replies Last reply Reply Quote 0
                  • bheplerB Offline
                    bhepler Module Developer @creepwood
                    last edited by

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      tajno @creepwood
                      last edited by

                      @creepwood

                      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.

                      C 1 Reply Last reply Reply Quote 2
                      • C Offline
                        creepwood @tajno
                        last edited by creepwood

                        @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.

                        T 1 Reply Last reply Reply Quote 0
                        • T Offline
                          tajno @creepwood
                          last edited by

                          @creepwood

                          It’s not that, I don’t have this problem - Never seen a “in 1 day”. Maybe its a wrong value provided by your calendar? Do you have multiple calendars - and it appears at everyone?

                          I use now 8 different Calendars and I don’t get that issue - So I can’t say anything about it.

                          C 1 Reply Last reply Reply Quote 0
                          • C Offline
                            creepwood @tajno
                            last edited by

                            @tajno I have four different calendars two from a google account (hollidays and my own calendar) and two from facebook (birthdays and events)

                            I have a facebook event in five days (although the start time of it is passed so it’s actually less than 5 x 24h) is correct, while a birthday that’s on the 18th which is also in five days according to MMM. So something is off. according the the ICS file that’s subscribed there are absolute dates on when something happens. Since the calendars that are imported have absolute time stamps there’s really nothing wrong with them, it’s on the interpretation end (MMM)

                            So the closest birthday I have in my calendar is on the 18th of november, something that occurs in 3 days plus what’s left on this day which is less than two hours. That’s happening in in 74h while MMM-calendar says it’s in five days.

                            My event that’s on the 19th (Saturday) november at 19h00 is in five days and 21h, five days is correct tuesday+wednesday+thursday+friday+saturday.

                            I’m wondering if this changes to four days after midnight or of it changes to fourdays at 19h00 on tuesday. I will have to check that when I wake up tomorrow.

                            I’m really not interested in how many 24h periods is left, I want to know how many actual days are left.

                            1 Reply Last reply Reply Quote 0
                            • T Offline
                              tajno
                              last edited by

                              Thanks for your explanation.

                              You talk alot of birthdays, may it be possible that the person lives in another timezone? And so facebook - somehow - get a mess, like its more than 24 hours for them but less than, like 48 or 36 for us? At least facebook looks about “where you are” about a birthday., not what time it is over there…?

                              Im just curious because my calendars does not provide any “tomorrow” - only a “today”. The rest is showed like “in 2 days” For Birthdays I use an own hosted calendar on my webspace because I had to many alerts provided by facebook - so I checked an old photo and there I have also those values “Tomorrow” and so on… Maybe I try the event calendar and looks what happens at my mirror. Wunderlist provides also a “Tomorrow”, as it shown in the app. Facebook shows thoes values also on theyr page.

                              Very strange… Sorry that I can’t help you so far.

                              C 1 Reply Last reply Reply Quote 0
                              • C Offline
                                creepwood @tajno
                                last edited by

                                @tajno

                                I have almost no event/birthday that isn’t in my own timezone (CET). There is a birthday happening in about 50 minutes (when it’ll be 15th november) and it says tomorrow. I will keep an eye on the event on nov 19th how that’s presented

                                1 Reply Last reply Reply Quote 0
                                • CatoC Offline
                                  Cato Module Developer
                                  last edited by Cato

                                  Here is a screenshot from my mirror earlier tonight (Monday at 21:47) that shows two activities in 2 and 3 days:

                                  alt text

                                  They are both in the same Exchange calendar and on the same day (Thursday) as you can see here:

                                  alt text

                                  If this isn’t a bug, then I don’t know.

                                  Yes, I know that the culprit is probably Moments.js, but …

                                  1 Reply Last reply Reply Quote 1
                                  • CatoC Offline
                                    Cato Module Developer
                                    last edited by

                                    Btw, the “correct” answere, in my eyes, is three days, not two.

                                    1 Reply Last reply Reply Quote 1
                                    • C Offline
                                      creepwood
                                      last edited by

                                      Clock just turned to the 15th november here and my friends birthday is “today”, calendar is still saying tomorrow.

                                      CatoC 1 Reply Last reply Reply Quote 0
                                      • CatoC Offline
                                        Cato Module Developer @creepwood
                                        last edited by

                                        @creepwood Did you try to restart mirror or manually refresh? I guess updates only happen on the interval you’ve configured…(?)

                                        C 1 Reply Last reply Reply Quote 0
                                        • M Offline
                                          Matthes0815
                                          last edited by

                                          That’s almost what I posted in “Bug Hunt” (https://forum.magicmirror.builders/topic/915/today-on-november-1st-the-calendar-labels-a-birthday-on-october-31st-as-two-days-ago) a while ago.

                                          It might be mathematically right, but intuitively it’s wrong.
                                          I have a meeting on Saturday and one on Sunday, the one on Saturday is “in 4 days”, the one on Sunday is “in 6 days”.
                                          That’s irritating.

                                          But your problem, @creepwood, might be different. Please check the date/time of your raspi. ;)

                                          1 Reply Last reply Reply Quote 1
                                          • C Offline
                                            creepwood @Cato
                                            last edited by creepwood

                                            @Cato yeah I was a little bit too quick there. it’s now changed to “today”.

                                            @Matthes0815 Oh the time on the hardware is correct, otherwise the clock wouldn’t have shown right.

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1 / 1
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy