- ioBroker Community Home
- Deutsch
- Skripten / Logik
- Blockly
- Wie viel Tage bis Termin
Wie viel Tage bis Termin
-
Das habe ich beim rechnen mal probiert.
Hatte zu DD.MM.JJJJ konvertiert für das aktuelle Datum und den Termin, mit der Hoffnung dass dann die Uhrzeit ignoriert wird.
Wenn ich dann Termin-Uhrzeit rechne kommt NaN als Ergebniss.
@david-g sagte: Hatte zu DD.MM.JJJJ konvertiert für das aktuelle Datum
Die Lösung mal getestet?

date: 11.08.2021 (00:00 Uhr Ortszeit)
Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs -
Das habe ich beim rechnen mal probiert.
Hatte zu DD.MM.JJJJ konvertiert für das aktuelle Datum und den Termin, mit der Hoffnung dass dann die Uhrzeit ignoriert wird.
Wenn ich dann Termin-Uhrzeit rechne kommt NaN als Ergebniss.
@david-g
Ich habs!!! ;) - Als Blockly Legastheniker bin ich ganz stolz
So das funktioniert meines Erachtens:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="d1?gZzO#Ee;5nkD=25+p">termin</variable> <variable id=",{yVx}S,?U_1?xsS0IO;">heute</variable> <variable id="VM?rt|mIhKs?tvJ{G6E|">inTagen</variable> </variables> <block type="variables_set" id="P%BplVP^J:4=RP.Fk06[" x="87" y="38"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> <value name="VALUE"> <block type="text" id="z6cycfSj0mKCILp8-OKn"> <field name="TEXT">2021-08-10T20:00:00.000Z</field> </block> </value> <next> <block type="variables_set" id="C/jWKeNBnr.ZCPv}2KYl"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> <value name="VALUE"> <block type="convert_from_date" id="h^CggrSLC`]{BL}b=BIV"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="PHI)-xQjVC[}K0P$4WMi"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text_getSubstring" id="X3{W|mvT2$5OB]`vn2Eq"> <mutation at1="false" at2="true"></mutation> <field name="WHERE1">FIRST</field> <field name="WHERE2">FROM_START</field> <value name="STRING"> <block type="variables_get" id="VVO]kBR$JYvv$YbuK=;C"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="AT2"> <block type="text_indexOf" id="]9WIuP!/kSkCLGE4EOpV"> <field name="END">FIRST</field> <value name="VALUE"> <block type="variables_get" id="LxPXPb*R+*4i_z6MZP[a"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="FIND"> <shadow type="text" id="}@NDsVJtdwn@8.[JZK{1"> <field name="TEXT">T</field> </shadow> </value> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="U*l}yM;e)7yVD8T)MgP^"> <field name="TEXT">00:00</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="Cx*sQRm/Pwt6NuuLMNBb"> <field name="VAR" id=",{yVx}S,?U_1?xsS0IO;">heute</field> <value name="VALUE"> <block type="convert_from_date" id="-+QkN*;XsDvY3E@X@4,H"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="$gEQ)xy{UqB8l/8Yz7|z"> <mutation items="2"></mutation> <value name="ADD0"> <block type="time_get" id="`Mb?^~n*+3?E#i.4`NC#"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ-MM-TT</field> </block> </value> <value name="ADD1"> <block type="text" id="RuHYT0/REHu$c*D7pXcL"> <field name="TEXT">T00:00</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="N7x9UN]:=-5o?6=d4jed"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> <value name="VALUE"> <block type="math_round" id=";A(P7CYQGSfP`4dC]U{|"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="=dQLmrn_#x}r5a{-B}*W"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="?V!+2,apS9_ym.)w%PGU"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="AND[V0z/y@H:!`_i@m7A"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="D)jqxX5=sjt|c^HwBS]."> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="}T|ND~@8/)/fE@6GEiub"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="lm)9)3UC3f4f_]|X,O_3"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="B"> <shadow type="math_number" id="n16IlOivfSDyBWa,|V5Y"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="RPzMF6EVZsL(4[5:NV~{"> <field name="VAR" id=",{yVx}S,?U_1?xsS0IO;">heute</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="98?%-1Edl1xJ?e%m$Ubw"> <field name="NUM">86400000</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="debug" id="{g9O#GZD`Tp}@k+cZ%u,"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="]afAYRl}ohne}GU]uFn:"> <field name="TEXT">test</field> </shadow> <block type="text_join" id=")z^;LBNJASd5?4_t|y;$"> <mutation items="3"></mutation> <value name="ADD0"> <block type="text" id="8631V=0jJ:ih%f%luf|t"> <field name="TEXT">Der Termin ist in </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="x+Ze-dx!.E!$,*dm}c3!"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> </block> </value> <value name="ADD2"> <block type="text" id="-c;/Y?1EbU-V!k!-~vuI"> <field name="TEXT"> Tagen</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>Ich hab halt heute und den Termin in Variablen gespeichert. Du musst halt in die Variable Termin Deinen date-String setzen!!
So ohne debug und ohne heute Variable kann man das Blockly tatsächlich soweit vereinfachen:

<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="d1?gZzO#Ee;5nkD=25+p">termin</variable> <variable id="VM?rt|mIhKs?tvJ{G6E|">inTagen</variable> </variables> <block type="variables_set" id="P%BplVP^J:4=RP.Fk06[" x="13" y="-37"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> <value name="VALUE"> <block type="text" id="z6cycfSj0mKCILp8-OKn"> <field name="TEXT">2021-08-10T20:00:00.000Z</field> </block> </value> <next> <block type="variables_set" id="N7x9UN]:=-5o?6=d4jed"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> <value name="VALUE"> <block type="math_round" id=";A(P7CYQGSfP`4dC]U{|"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="=dQLmrn_#x}r5a{-B}*W"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="?V!+2,apS9_ym.)w%PGU"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="AND[V0z/y@H:!`_i@m7A"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="D)jqxX5=sjt|c^HwBS]."> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="}T|ND~@8/)/fE@6GEiub"> <field name="NUM">1</field> </shadow> <block type="convert_from_date" id="h^CggrSLC`]{BL}b=BIV"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="PHI)-xQjVC[}K0P$4WMi"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text_getSubstring" id="X3{W|mvT2$5OB]`vn2Eq"> <mutation at1="false" at2="true"></mutation> <field name="WHERE1">FIRST</field> <field name="WHERE2">FROM_START</field> <value name="STRING"> <block type="variables_get" id="VVO]kBR$JYvv$YbuK=;C"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="AT2"> <block type="text_indexOf" id="]9WIuP!/kSkCLGE4EOpV"> <field name="END">FIRST</field> <value name="VALUE"> <block type="variables_get" id="LxPXPb*R+*4i_z6MZP[a"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="FIND"> <shadow type="text" id="}@NDsVJtdwn@8.[JZK{1"> <field name="TEXT">T</field> </shadow> </value> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="U*l}yM;e)7yVD8T)MgP^"> <field name="TEXT">00:00</field> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="n16IlOivfSDyBWa,|V5Y"> <field name="NUM">1</field> </shadow> <block type="convert_from_date" id="-+QkN*;XsDvY3E@X@4,H"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="$gEQ)xy{UqB8l/8Yz7|z"> <mutation items="2"></mutation> <value name="ADD0"> <block type="time_get" id="`Mb?^~n*+3?E#i.4`NC#"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ-MM-TT</field> </block> </value> <value name="ADD1"> <block type="text" id="RuHYT0/REHu$c*D7pXcL"> <field name="TEXT">T00:00</field> </block> </value> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="98?%-1Edl1xJ?e%m$Ubw"> <field name="NUM">86400000</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="debug" id="{g9O#GZD`Tp}@k+cZ%u,"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="]afAYRl}ohne}GU]uFn:"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="x+Ze-dx!.E!$,*dm}c3!"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> </block> </value> </block> </next> </block> </next> </block> </xml>Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.
-
@david-g
Ich habs!!! ;) - Als Blockly Legastheniker bin ich ganz stolz
So das funktioniert meines Erachtens:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="d1?gZzO#Ee;5nkD=25+p">termin</variable> <variable id=",{yVx}S,?U_1?xsS0IO;">heute</variable> <variable id="VM?rt|mIhKs?tvJ{G6E|">inTagen</variable> </variables> <block type="variables_set" id="P%BplVP^J:4=RP.Fk06[" x="87" y="38"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> <value name="VALUE"> <block type="text" id="z6cycfSj0mKCILp8-OKn"> <field name="TEXT">2021-08-10T20:00:00.000Z</field> </block> </value> <next> <block type="variables_set" id="C/jWKeNBnr.ZCPv}2KYl"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> <value name="VALUE"> <block type="convert_from_date" id="h^CggrSLC`]{BL}b=BIV"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="PHI)-xQjVC[}K0P$4WMi"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text_getSubstring" id="X3{W|mvT2$5OB]`vn2Eq"> <mutation at1="false" at2="true"></mutation> <field name="WHERE1">FIRST</field> <field name="WHERE2">FROM_START</field> <value name="STRING"> <block type="variables_get" id="VVO]kBR$JYvv$YbuK=;C"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="AT2"> <block type="text_indexOf" id="]9WIuP!/kSkCLGE4EOpV"> <field name="END">FIRST</field> <value name="VALUE"> <block type="variables_get" id="LxPXPb*R+*4i_z6MZP[a"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="FIND"> <shadow type="text" id="}@NDsVJtdwn@8.[JZK{1"> <field name="TEXT">T</field> </shadow> </value> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="U*l}yM;e)7yVD8T)MgP^"> <field name="TEXT">00:00</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="Cx*sQRm/Pwt6NuuLMNBb"> <field name="VAR" id=",{yVx}S,?U_1?xsS0IO;">heute</field> <value name="VALUE"> <block type="convert_from_date" id="-+QkN*;XsDvY3E@X@4,H"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="$gEQ)xy{UqB8l/8Yz7|z"> <mutation items="2"></mutation> <value name="ADD0"> <block type="time_get" id="`Mb?^~n*+3?E#i.4`NC#"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ-MM-TT</field> </block> </value> <value name="ADD1"> <block type="text" id="RuHYT0/REHu$c*D7pXcL"> <field name="TEXT">T00:00</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="N7x9UN]:=-5o?6=d4jed"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> <value name="VALUE"> <block type="math_round" id=";A(P7CYQGSfP`4dC]U{|"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="=dQLmrn_#x}r5a{-B}*W"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="?V!+2,apS9_ym.)w%PGU"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="AND[V0z/y@H:!`_i@m7A"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="D)jqxX5=sjt|c^HwBS]."> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="}T|ND~@8/)/fE@6GEiub"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="lm)9)3UC3f4f_]|X,O_3"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="B"> <shadow type="math_number" id="n16IlOivfSDyBWa,|V5Y"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="RPzMF6EVZsL(4[5:NV~{"> <field name="VAR" id=",{yVx}S,?U_1?xsS0IO;">heute</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="98?%-1Edl1xJ?e%m$Ubw"> <field name="NUM">86400000</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="debug" id="{g9O#GZD`Tp}@k+cZ%u,"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="]afAYRl}ohne}GU]uFn:"> <field name="TEXT">test</field> </shadow> <block type="text_join" id=")z^;LBNJASd5?4_t|y;$"> <mutation items="3"></mutation> <value name="ADD0"> <block type="text" id="8631V=0jJ:ih%f%luf|t"> <field name="TEXT">Der Termin ist in </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="x+Ze-dx!.E!$,*dm}c3!"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> </block> </value> <value name="ADD2"> <block type="text" id="-c;/Y?1EbU-V!k!-~vuI"> <field name="TEXT"> Tagen</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>Ich hab halt heute und den Termin in Variablen gespeichert. Du musst halt in die Variable Termin Deinen date-String setzen!!
So ohne debug und ohne heute Variable kann man das Blockly tatsächlich soweit vereinfachen:

<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="d1?gZzO#Ee;5nkD=25+p">termin</variable> <variable id="VM?rt|mIhKs?tvJ{G6E|">inTagen</variable> </variables> <block type="variables_set" id="P%BplVP^J:4=RP.Fk06[" x="13" y="-37"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> <value name="VALUE"> <block type="text" id="z6cycfSj0mKCILp8-OKn"> <field name="TEXT">2021-08-10T20:00:00.000Z</field> </block> </value> <next> <block type="variables_set" id="N7x9UN]:=-5o?6=d4jed"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> <value name="VALUE"> <block type="math_round" id=";A(P7CYQGSfP`4dC]U{|"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="=dQLmrn_#x}r5a{-B}*W"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="?V!+2,apS9_ym.)w%PGU"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="AND[V0z/y@H:!`_i@m7A"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="D)jqxX5=sjt|c^HwBS]."> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="}T|ND~@8/)/fE@6GEiub"> <field name="NUM">1</field> </shadow> <block type="convert_from_date" id="h^CggrSLC`]{BL}b=BIV"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="PHI)-xQjVC[}K0P$4WMi"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text_getSubstring" id="X3{W|mvT2$5OB]`vn2Eq"> <mutation at1="false" at2="true"></mutation> <field name="WHERE1">FIRST</field> <field name="WHERE2">FROM_START</field> <value name="STRING"> <block type="variables_get" id="VVO]kBR$JYvv$YbuK=;C"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="AT2"> <block type="text_indexOf" id="]9WIuP!/kSkCLGE4EOpV"> <field name="END">FIRST</field> <value name="VALUE"> <block type="variables_get" id="LxPXPb*R+*4i_z6MZP[a"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="FIND"> <shadow type="text" id="}@NDsVJtdwn@8.[JZK{1"> <field name="TEXT">T</field> </shadow> </value> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="U*l}yM;e)7yVD8T)MgP^"> <field name="TEXT">00:00</field> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="n16IlOivfSDyBWa,|V5Y"> <field name="NUM">1</field> </shadow> <block type="convert_from_date" id="-+QkN*;XsDvY3E@X@4,H"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="$gEQ)xy{UqB8l/8Yz7|z"> <mutation items="2"></mutation> <value name="ADD0"> <block type="time_get" id="`Mb?^~n*+3?E#i.4`NC#"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ-MM-TT</field> </block> </value> <value name="ADD1"> <block type="text" id="RuHYT0/REHu$c*D7pXcL"> <field name="TEXT">T00:00</field> </block> </value> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="98?%-1Edl1xJ?e%m$Ubw"> <field name="NUM">86400000</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="debug" id="{g9O#GZD`Tp}@k+cZ%u,"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="]afAYRl}ohne}GU]uFn:"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="x+Ze-dx!.E!$,*dm}c3!"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> </block> </value> </block> </next> </block> </next> </block> </xml> -
@david-g
Ich habs!!! ;) - Als Blockly Legastheniker bin ich ganz stolz
So das funktioniert meines Erachtens:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="d1?gZzO#Ee;5nkD=25+p">termin</variable> <variable id=",{yVx}S,?U_1?xsS0IO;">heute</variable> <variable id="VM?rt|mIhKs?tvJ{G6E|">inTagen</variable> </variables> <block type="variables_set" id="P%BplVP^J:4=RP.Fk06[" x="87" y="38"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> <value name="VALUE"> <block type="text" id="z6cycfSj0mKCILp8-OKn"> <field name="TEXT">2021-08-10T20:00:00.000Z</field> </block> </value> <next> <block type="variables_set" id="C/jWKeNBnr.ZCPv}2KYl"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> <value name="VALUE"> <block type="convert_from_date" id="h^CggrSLC`]{BL}b=BIV"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="PHI)-xQjVC[}K0P$4WMi"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text_getSubstring" id="X3{W|mvT2$5OB]`vn2Eq"> <mutation at1="false" at2="true"></mutation> <field name="WHERE1">FIRST</field> <field name="WHERE2">FROM_START</field> <value name="STRING"> <block type="variables_get" id="VVO]kBR$JYvv$YbuK=;C"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="AT2"> <block type="text_indexOf" id="]9WIuP!/kSkCLGE4EOpV"> <field name="END">FIRST</field> <value name="VALUE"> <block type="variables_get" id="LxPXPb*R+*4i_z6MZP[a"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="FIND"> <shadow type="text" id="}@NDsVJtdwn@8.[JZK{1"> <field name="TEXT">T</field> </shadow> </value> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="U*l}yM;e)7yVD8T)MgP^"> <field name="TEXT">00:00</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="Cx*sQRm/Pwt6NuuLMNBb"> <field name="VAR" id=",{yVx}S,?U_1?xsS0IO;">heute</field> <value name="VALUE"> <block type="convert_from_date" id="-+QkN*;XsDvY3E@X@4,H"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="$gEQ)xy{UqB8l/8Yz7|z"> <mutation items="2"></mutation> <value name="ADD0"> <block type="time_get" id="`Mb?^~n*+3?E#i.4`NC#"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ-MM-TT</field> </block> </value> <value name="ADD1"> <block type="text" id="RuHYT0/REHu$c*D7pXcL"> <field name="TEXT">T00:00</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="N7x9UN]:=-5o?6=d4jed"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> <value name="VALUE"> <block type="math_round" id=";A(P7CYQGSfP`4dC]U{|"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="=dQLmrn_#x}r5a{-B}*W"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="?V!+2,apS9_ym.)w%PGU"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="AND[V0z/y@H:!`_i@m7A"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="D)jqxX5=sjt|c^HwBS]."> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="}T|ND~@8/)/fE@6GEiub"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="lm)9)3UC3f4f_]|X,O_3"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="B"> <shadow type="math_number" id="n16IlOivfSDyBWa,|V5Y"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="RPzMF6EVZsL(4[5:NV~{"> <field name="VAR" id=",{yVx}S,?U_1?xsS0IO;">heute</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="98?%-1Edl1xJ?e%m$Ubw"> <field name="NUM">86400000</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="debug" id="{g9O#GZD`Tp}@k+cZ%u,"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="]afAYRl}ohne}GU]uFn:"> <field name="TEXT">test</field> </shadow> <block type="text_join" id=")z^;LBNJASd5?4_t|y;$"> <mutation items="3"></mutation> <value name="ADD0"> <block type="text" id="8631V=0jJ:ih%f%luf|t"> <field name="TEXT">Der Termin ist in </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="x+Ze-dx!.E!$,*dm}c3!"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> </block> </value> <value name="ADD2"> <block type="text" id="-c;/Y?1EbU-V!k!-~vuI"> <field name="TEXT"> Tagen</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>Ich hab halt heute und den Termin in Variablen gespeichert. Du musst halt in die Variable Termin Deinen date-String setzen!!
So ohne debug und ohne heute Variable kann man das Blockly tatsächlich soweit vereinfachen:

<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="d1?gZzO#Ee;5nkD=25+p">termin</variable> <variable id="VM?rt|mIhKs?tvJ{G6E|">inTagen</variable> </variables> <block type="variables_set" id="P%BplVP^J:4=RP.Fk06[" x="13" y="-37"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> <value name="VALUE"> <block type="text" id="z6cycfSj0mKCILp8-OKn"> <field name="TEXT">2021-08-10T20:00:00.000Z</field> </block> </value> <next> <block type="variables_set" id="N7x9UN]:=-5o?6=d4jed"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> <value name="VALUE"> <block type="math_round" id=";A(P7CYQGSfP`4dC]U{|"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="=dQLmrn_#x}r5a{-B}*W"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="?V!+2,apS9_ym.)w%PGU"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="AND[V0z/y@H:!`_i@m7A"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="D)jqxX5=sjt|c^HwBS]."> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="}T|ND~@8/)/fE@6GEiub"> <field name="NUM">1</field> </shadow> <block type="convert_from_date" id="h^CggrSLC`]{BL}b=BIV"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="PHI)-xQjVC[}K0P$4WMi"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text_getSubstring" id="X3{W|mvT2$5OB]`vn2Eq"> <mutation at1="false" at2="true"></mutation> <field name="WHERE1">FIRST</field> <field name="WHERE2">FROM_START</field> <value name="STRING"> <block type="variables_get" id="VVO]kBR$JYvv$YbuK=;C"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="AT2"> <block type="text_indexOf" id="]9WIuP!/kSkCLGE4EOpV"> <field name="END">FIRST</field> <value name="VALUE"> <block type="variables_get" id="LxPXPb*R+*4i_z6MZP[a"> <field name="VAR" id="d1?gZzO#Ee;5nkD=25+p">termin</field> </block> </value> <value name="FIND"> <shadow type="text" id="}@NDsVJtdwn@8.[JZK{1"> <field name="TEXT">T</field> </shadow> </value> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="U*l}yM;e)7yVD8T)MgP^"> <field name="TEXT">00:00</field> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="n16IlOivfSDyBWa,|V5Y"> <field name="NUM">1</field> </shadow> <block type="convert_from_date" id="-+QkN*;XsDvY3E@X@4,H"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="text_join" id="$gEQ)xy{UqB8l/8Yz7|z"> <mutation items="2"></mutation> <value name="ADD0"> <block type="time_get" id="`Mb?^~n*+3?E#i.4`NC#"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ-MM-TT</field> </block> </value> <value name="ADD1"> <block type="text" id="RuHYT0/REHu$c*D7pXcL"> <field name="TEXT">T00:00</field> </block> </value> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="98?%-1Edl1xJ?e%m$Ubw"> <field name="NUM">86400000</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="debug" id="{g9O#GZD`Tp}@k+cZ%u,"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="]afAYRl}ohne}GU]uFn:"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="x+Ze-dx!.E!$,*dm}c3!"> <field name="VAR" id="VM?rt|mIhKs?tvJ{G6E|">inTagen</field> </block> </value> </block> </next> </block> </next> </block> </xml>Hab es nachgebaut und läuft.
Muss allerdings wie bei meinem Versuch noch 1 drauf rechnen. Der Morgige Tag liefert 0 als Ergebniss.Das ist die generierte Nachricht.
Damit ihr auch seht, worum es geht.
Alter Screen als ein Geburtstag anstand.

Geht wenn die Sonntags verschickt wird dann schön von Mo bis So alle Tage durch.
(sind grad noch einige Testtermine hinterlegt. Die Geburtstage werden wie die anderen Termine dargestellt.)@mickym
Nicht, dass du noch von node red zu blockly abwanderst 🤪 -
Hab es nachgebaut und läuft.
Muss allerdings wie bei meinem Versuch noch 1 drauf rechnen. Der Morgige Tag liefert 0 als Ergebniss.Das ist die generierte Nachricht.
Damit ihr auch seht, worum es geht.
Alter Screen als ein Geburtstag anstand.

Geht wenn die Sonntags verschickt wird dann schön von Mo bis So alle Tage durch.
(sind grad noch einige Testtermine hinterlegt. Die Geburtstage werden wie die anderen Termine dargestellt.)@mickym
Nicht, dass du noch von node red zu blockly abwanderst 🤪@david-g Ehrlich gesagt verstehe ich zwar nicht, warum Du eins drauf rechnen musst, weil wenn Du mein Teil da importiert hast und den String als Termin als Ausgang nimmst - funktioniert es so. Aber egal Du hast Dir ja geholfen. ;)
@david-g sagte in Wie viel Tage bis Termin:
@mickym
Nicht, dass du noch von node red zu blockly abwanderst 🤪Da brauchst Du keine Sorge haben - aber will auch nicht mehr diese Diskussion beginnen. ;)
Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.
-
@david-g Ehrlich gesagt verstehe ich zwar nicht, warum Du eins drauf rechnen musst, weil wenn Du mein Teil da importiert hast und den String als Termin als Ausgang nimmst - funktioniert es so. Aber egal Du hast Dir ja geholfen. ;)
@david-g sagte in Wie viel Tage bis Termin:
@mickym
Nicht, dass du noch von node red zu blockly abwanderst 🤪Da brauchst Du keine Sorge haben - aber will auch nicht mehr diese Diskussion beginnen. ;)
Habe deinen Code nicht importieren können.
Hat immer einen Fehler ausgegeben.
Aber war ja schnell nachzubauen.Evtl wird das Datum anders gewertet, was er in der Schleife aus dem Datenpunkt holt..... Ka....
Jedenfalls vielen Dank für die Hilfe.
Keine Sorge, die Diskussion müssen wir nicht führen.
Wurde A schon oft genug geführt und B kann jeder machen was ihm besser gefällt.
Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.
Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.
Mit deinem Input könnte dieser Beitrag noch besser werden 💗
Registrieren Anmelden