MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    Calendar showing "in X day" wrongly

    Troubleshooting
    6
    20
    8656
    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
      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)

      bhepler 1 Reply Last reply Reply Quote 0
      • bhepler
        bhepler Project Sponsor @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
        • KirAsh4
          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?

          Cato C 2 Replies Last reply Reply Quote 0
          • Cato
            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
              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
              • KirAsh4
                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
                  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.

                  bhepler T 2 Replies Last reply Reply Quote 0
                  • bhepler
                    bhepler Project Sponsor @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
                      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
                        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
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy