Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Frage zu : Muster "isDateinRange"

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Frage zu : Muster "isDateinRange"

    This topic has been deleted. Only users with topic management privileges can see it.
    • bahnuhr
      bahnuhr Forum Testing Most Active last edited by

      @Homoran:

      Die Grenzdaten sind wie torpfosten, der Ball muss dazwischen durch, nicht dagegen, sonst ist es kein Tor. `

      Wenn deine These stimmt, dann müsste mein 1. Beispiel nicht funktionieren.

      Denn da liegt now = lower.

      mfg

      1 Reply Last reply Reply Quote 0
      • bahnuhr
        bahnuhr Forum Testing Most Active last edited by

        Ich vermute mal das Problem liegt an den Variablen "lower" und "upper".

        Ich hab diese mal geloggt.

        Ergebnis:
        filename="bild1.jpg" index="0">~~

        Hier sieht man, dass nicht nur das Datum, sondern auch die Uhrzeit gespeichert ist.

        Und das führt m.E. zu falschem Ergebnis.

        mfg

        1 Reply Last reply Reply Quote 0
        • bahnuhr
          bahnuhr Forum Testing Most Active last edited by

          Hallo Homoran,

          konntest du das Script mal testen ?

          mfg

          1 Reply Last reply Reply Quote 0
          • Homoran
            Homoran Global Moderator Administrators last edited by

            @bahnuhr:

            konntest du das Script mal testen ? `

            Nein, außerdem wäre ich als Script Legastheniker dafür der falsche. 😄

            Gruß

            Rainer

            1 Reply Last reply Reply Quote 0
            • bahnuhr
              bahnuhr Forum Testing Most Active last edited by

              ok,

              kann jemand anders das script mal überprüfen.

              mfg

              Dieter

              1 Reply Last reply Reply Quote 0
              • paul53
                paul53 last edited by

                Versuche es mal mit folgendem Script:

                function isDateInRange(lower, upper) {
                    var now = Date.now();
                    lower = lower.split('.');
                    upper = upper.split('.');
                    lower = new Date(lower[2], lower[1] - 1, lower[0]).getTime();
                    upper = new Date(upper[2], upper[1] - 1, upper[0], 23, 59, 59, 999).getTime();
                    var inRange = false;
                    if (upper > lower) inRange = (now >= lower && now <= upper) ? true : false;
                    else log('isDateInRange meldet Fehler! "von"-Datum ist später als "bis"-Datum', 'warn');
                    return inRange;
                }
                
                
                1 Reply Last reply Reply Quote 0
                • bahnuhr
                  bahnuhr Forum Testing Most Active last edited by

                  paul53 !

                  das wars.

                  Spitze.

                  Klappt wunderbar.

                  Man sollte dein Script mit dem Muster auf "iobroker" austauschen.

                  -> wenn ein admin mit liest ! <-

                  mfg

                  Dieter

                  1 Reply Last reply Reply Quote 0
                  • Homoran
                    Homoran Global Moderator Administrators last edited by

                    Ich lese!

                    Auch wenn ich nur Mod bin 😮

                    Mal sehen, wann ich wieder an einen PC kann

                    Guten Rutsch

                    Rainer

                    1 Reply Last reply Reply Quote 0
                    • bahnuhr
                      bahnuhr Forum Testing Most Active last edited by

                      Hallo Hamoran,

                      das Time ! in Range auch austauschen.

                      mfg

                      Dieter

                      1 Reply Last reply Reply Quote 0
                      • P
                        pix last edited by

                        Melde mich auch mal dazu:

                        ich habe das neue Skript noch nicht getestet. Das alte Skript habe ich auf der Basis http://forum.iobroker.net/viewtopic.php?f=21&t=1072&p=11167&hilit=istimeinrange&sid=5d5834ef7192dc471724e2fb9e5b80e5#p8484 auf isDateinRange umgebastelt

                        http://forum.iobroker.net/viewtopic.php … 20&p=25886

                        Bisher hatte ich keine Fehler, aber ich werde es mir ansehen, wenn ich Zeit finde. Danke für die Meldung!

                        Gruß

                        Pix

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        422
                        Online

                        31.9k
                        Users

                        80.3k
                        Topics

                        1.3m
                        Posts

                        4
                        13
                        1154
                        Loading More Posts
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes
                        Reply
                        • Reply as topic
                        Log in to reply
                        Community
                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                        The ioBroker Community 2014-2023
                        logo