• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Default Calender relative removes start time

Scheduled Pinned Locked Moved Solved Troubleshooting
14 Posts 3 Posters 5.1k Views 3 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
    cptkex
    last edited by Nov 7, 2018, 10:28 AM

    Hello everyone! First time poster, and a newbie when it comes to Linux and the Raspberry PI.

    I am in the process of creating my own Magic mirror, but i was wondering what i need to do to change how the relative time for calender events is displayed?

    right now, i´ve got it set to absolute up until 5 hours before, then it goes into relative mode.

    So in absolute form
    Meeting 25th november 1000-1800

    But, five hours before this, it goes into relative mode

    Meeting 25th november in five hours - 1800

    It seems to remove the start time of any event, and i would like to have both, so even when it goes relative, i would like to keep the start time after the countdown, so like this:

    Meeting 25th november in five hours 1000-1800

    is it possible and where do i need to alter the code of the pre installed calender module?

    Hoping for some beginner-level help!

    L 1 Reply Last reply Nov 7, 2018, 11:50 AM Reply Quote 0
    • L Offline
      lavolp3 Module Developer @cptkex
      last edited by Nov 7, 2018, 11:50 AM

      @cptkex That’s an interesting question!
      I’m working on manipulating the calendar and moment.js as well.

      The line you are looking for is line 302

      timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
      

      .fromnow() creates the “in five hours” entry. You would have to stuff the beginning time into that, maybe it would work like this:

      timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow()) + moment(event.startDate).format('HH:mm');
      

      This could work…

      In your calendar, do you really have this entry?
      “Meeting 25th november in five hours - 1800”

      Because then it seems you have already manpulatied the entry to also show the date!?

      C 2 Replies Last reply Nov 7, 2018, 12:30 PM Reply Quote 0
      • C Offline
        cptkex @lavolp3
        last edited by Nov 7, 2018, 12:30 PM

        @lavolp3 thanks for that suggestion, ill try that tonight when i get home!

        I will have to check when i get home, i was moving between the three options of absolute, relative and dateheader and i dont really remember if it gave me the date when i switched back to absolute.

        ill doublecheck tonight, because i was trying to achieve my wish of having the start time to be absolute by changing the startdate variable to MMM Do HH:mm. ill get back to you on this. Again, sorry, kind of new at this.

        L 1 Reply Last reply Nov 7, 2018, 12:54 PM Reply Quote 0
        • L Offline
          lavolp3 Module Developer @cptkex
          last edited by Nov 7, 2018, 12:54 PM

          @cptkex
          Aha! The “dateheaders” option is quite new and I haven’t seen that before. Will check that out as well

          C 1 Reply Last reply Nov 7, 2018, 5:19 PM Reply Quote 0
          • C Offline
            cptkex @lavolp3
            last edited by Nov 7, 2018, 5:19 PM

            @lavolp3 I’m home and I was mistaken. It does not show the date when it goes into relative, only the end time. I will try your code later tonight and see if it works.

            1 Reply Last reply Reply Quote 0
            • C Offline
              cptkex @lavolp3
              last edited by Nov 7, 2018, 6:32 PM

              @lavolp3 i tried your addition to the code but it only said

              meeting in 5 hoursInvalid Date-1800

              L 2 Replies Last reply Nov 8, 2018, 9:10 AM Reply Quote 0
              • L Offline
                lavolp3 Module Developer
                last edited by Nov 8, 2018, 9:08 AM

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • L Offline
                  lavolp3 Module Developer @cptkex
                  last edited by Nov 8, 2018, 9:10 AM

                  @cptkex There is an open issue that might describe the same issue:
                  https://github.com/MichMich/MagicMirror/issues/1457
                  Yours?
                  Else it might be worth following.

                  C 1 Reply Last reply Nov 8, 2018, 9:22 AM Reply Quote 0
                  • C Offline
                    cptkex @lavolp3
                    last edited by Nov 8, 2018, 9:22 AM

                    @lavolp3 not mine, but thanks, i will keep an eye on it

                    1 Reply Last reply Reply Quote 0
                    • L Offline
                      lavolp3 Module Developer @cptkex
                      last edited by Nov 8, 2018, 10:19 AM

                      @cptkex
                      You could try this

                      timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow()) + this.capFirst(moment(event.startDate, "x").format(this.config.dateEndFormat));
                      

                      I took the dirty way to use the dateEndFormat variable for a starting time.
                      This is just a guess! I haven’t tried it out yet…

                      C 1 Reply Last reply Nov 9, 2018, 1:52 PM Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        3/14
                        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