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

MMM-CalendarEXT2 - Calendar Read Failing When Time Value Is Missing from ics file

Scheduled Pinned Locked Moved Solved Troubleshooting
28 Posts 3 Posters 9.8k 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.
  • S Offline
    sdetweil @edd189
    last edited by Jun 10, 2023, 4:05 PM

    @edd189 missed that…

    anyhow… I think you are stuck… , and will have to fix it yourself

    unless the original author chooses to help.

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    E 1 Reply Last reply Jun 10, 2023, 4:18 PM Reply Quote 0
    • E Offline
      edd189 @sdetweil
      last edited by Jun 10, 2023, 4:18 PM

      @sdetweil said in MMM-CalendarEXT2 - Calendar Read Failing When Time Value Is Missing from ics file:

      and will have to fix it yourself

      I know, that’s what I’m asking for help with here. :)

      I don’t understand in the code where the call to the ics file occurs. If I can find it and just append 0’s where no time exists, I believe that will solve it.

      I found this in CALEXT2_Event.js. Any idea if this is where the call is made?

      const now = moment().locale(locale);
      if (this.useEventTimeRelative) {
        let status = "current";
        if (this.mEnd.isBefore(now)) status = "passed";
        if (this.mStart.isAfter(now)) status = "future";
        const timeDom = document.createElement("div");
        timeDom.classList.add("relative");
        timeDom.classList.add(status);
        timeDom.innerHTML = this.relativeFormat[status]
          .replace("%ENDFROMNOW%", this.mEnd.fromNow())
          .replace("%STARTFROMNOW%", this.mStart.fromNow())
          .replace("%DURATION%", dur.humanize());
        if (typeof this.dateFormat === "string") {
          timeDom.innerHTML
            .replace("%STARTDATE%", this.mStart.format(this.dateFormat))
            .replace("%ENDDATE%", this.mEnd.format(this.dateFormat));
        }
        time.appendChild(timeDom);
      } else {
        let sd;
        let ed;
        let st;
        let et;
        let sdt;
        let edt = null;
        if (typeof this.dateFormat === "object") {
          sd = this.mStart.calendar(null, this.dateFormat);
          ed = this.mEnd.calendar(null, this.dateFormat);
        } else {
          sd = this.mStart.format(this.dateFormat);
          ed = this.mEnd.format(this.dateFormat);
        }
        if (typeof this.timeFormat === "object") {
          st = this.mStart.calendar(null, this.timeFormat);
          et = this.mEnd.calendar(null, this.timeFormat);
        } else {
          st = this.mStart.format(this.timeFormat);
          et = this.mEnd.format(this.timeFormat);
        }
        if (typeof this.dateTimeFormat === "object") {
          sdt = this.mStart.calendar(null, this.dateTimeFormat);
          edt = this.mEnd.calendar(null, this.dateTimeFormat);
        } else {
          sdt = this.mStart.format(this.dateTimeFormat);
          edt = this.mEnd.format(this.dateTimeFormat);
        }
        time.appendChild(makeEventTime(sd, "startDate start date"));
        time.appendChild(makeEventTime(st, "startTime start time"));
        time.appendChild(makeEventTime(sdt, "startDateTime start dateTime"));
        time.appendChild(makeEventTime(ed, "endDate end date"));
        time.appendChild(makeEventTime(et, "endTime end time"));
        time.appendChild(makeEventTime(edt, "endDateTime end dateTime"));
      }
      return time;
      
      S 1 Reply Last reply Jun 10, 2023, 4:31 PM Reply Quote 0
      • S Offline
        sdetweil @edd189
        last edited by Jun 10, 2023, 4:31 PM

        @edd189 its in the node_helper.js

            url = url.replace("webcal://", "http://");
            try {
              response = await fetch(url, opts);
        

        approx line 90

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        E 1 Reply Last reply Jun 10, 2023, 9:00 PM Reply Quote 0
        • E Offline
          edd189 @sdetweil
          last edited by edd189 Jun 10, 2023, 9:37 PM Jun 10, 2023, 9:00 PM

          @sdetweil Well, this is quickly becoming a bugabear!

          The error is passed all the way from ical.js (found here: https://github.com/kewisch/ical.js) via a call through iCalExpander (found here: https://github.com/mifi/ical-expander) on node_helper.js line 137.

          Line 1107 in time.js (sub-module of ical.js):

          static fromDateTimeString(aValue, prop) {
          if (aValue.length < 19) {
          throw new Error(
          ‘invalid date-time value: "’ + aValue + ‘"’
          );
          }

          This seems odd to me. I’m working with two different ics files and both of them present a problem for these four lines of code. But my computer, iPhone, and other MMM modules handle the ics file fine. Is this ics.js not used by other calendar modules? Did the accepted format for an ical file change at some point since CX2 was developed?

          Acceptable format of an ics entry lists the time as an optional component: https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.2

          Time to dig more into their methods I suppose…

          S 1 Reply Last reply Jun 10, 2023, 9:04 PM Reply Quote 0
          • S Offline
            sdetweil @edd189
            last edited by sdetweil Jun 10, 2023, 9:04 PM Jun 10, 2023, 9:04 PM

            @edd189 if the time is not specified, the event is a full day event.

            spec hasn’t changed, but the ics providers have changed their data, outside the spec.

            MS in particular has started using the custom timezone feature, and mapping all the events to their custom(overlapping with IANA based standard timezones)

            all this breaks a bunch of stuff…

            only the calendar modules use the ics parser. ext2 had its own. MM default uses node-ical

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            E 1 Reply Last reply Jun 10, 2023, 9:18 PM Reply Quote 0
            • E Offline
              edd189 @sdetweil
              last edited by Jun 10, 2023, 9:18 PM

              @sdetweil Looks like the ics.js branch being used by CX2 had a report on this issue around a year ago with no fix. :(

              https://github.com/kewisch/ical.js/issues/515

              S 1 Reply Last reply Jun 10, 2023, 9:22 PM Reply Quote 0
              • S Offline
                sdetweil @edd189
                last edited by Jun 10, 2023, 9:22 PM

                @edd189 yep, stuff gets old, people get tired, or move on… or it becomes too much work to keep it up to date

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                E 1 Reply Last reply Jun 10, 2023, 9:36 PM Reply Quote 0
                • E Offline
                  edd189 @sdetweil
                  last edited by edd189 Jun 10, 2023, 9:55 PM Jun 10, 2023, 9:36 PM

                  @sdetweil

                  from line 1142:
                  ICAL.Time.fromString = function fromString(aValue) {
                  if (aValue.length > 10) {
                  return ICAL.Time.fromDateTimeString(aValue);
                  } else {
                  return ICAL.Time.fromDateString(aValue);
                  }
                  };

                  Looks like time.js within (https://github.com/kewisch/ical.js) is already trying to do something different with the entry if the length is less than 10. But that count seems off to me – it should never make the call to line 1107 (fromDateTimeString) at all. It should be using line 1083 (fromDateString).

                  S 1 Reply Last reply Jun 10, 2023, 9:40 PM Reply Quote 0
                  • S Offline
                    sdetweil @edd189
                    last edited by sdetweil Jun 10, 2023, 9:57 PM Jun 10, 2023, 9:40 PM

                    @edd189 you could

                    console.log("aValue='"+aValue+"'")
                    

                    to check its contents (in the mm startup output)

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    E 1 Reply Last reply Jun 10, 2023, 9:53 PM Reply Quote 0
                    • E Offline
                      edd189 @sdetweil
                      last edited by Jun 10, 2023, 9:53 PM

                      @sdetweil

                      I tried to put

                      console.log(‘[CALEXT2] calendar: >> error on line 1111’);

                      within the time.js file, found embedded within the CX2 directory. It didn’t output anything. Will a sub-rountine embedded a few layers down still output to the console? Do I need to reinstall or re-link anything?

                      S 1 Reply Last reply Jun 10, 2023, 9:56 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 1 / 3
                      1 / 3
                      • First post
                        8/28
                        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