Timeconversion: Astro Binding (DateTime) to Date() javascript object

So after reading a bit in Use of Timers within OH 3 - #22 by rlkoshak, I created the Rule with the timer now inside OH3.

The old OH2 rule

var Timer timer_Abwesenheitspuffer = null

rule "Licht und SONOS - Leaving Home"
when
    Item Dummy_Anwesenheit changed
then
    timer_Abwesenheitspuffer?.cancel()
    timer_Abwesenheitspuffer = null

    if (Dummy_Anwesenheit.state == "Abwesend") {
        timer_Abwesenheitspuffer = createTimer(now.plusMinutes(1), [| 
            if (Dummy_Anwesenheit.state == "Abwesend") {
                GP_Gesamtes_Licht_Wohnung.sendCommand("OFF")
                GP_Sonos.sendCommand("OFF") 
            }
        ])
    }
end

So the timer gets “resetted” when the rule triggers again.

My OH3 rule looks like that now (only the “then” part):

var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.' + ctx.ruleUID);
var ScriptExecution = Java.type("org.openhab.core.model.script.actions.ScriptExecution");
var ZonedDateTime   = Java.type("java.time.ZonedDateTime");

if (this.pufferTimer) {
  this.pufferTimer.cancel();
}
this.pufferTimer = null;
//this.pufferTimer = (this.pufferTimer === undefined) ? null : this.pufferTimer;

if (items["Dummy_Anwesenheit"] == OFF) {
  pufferTimer = ScriptExecution.createTimer(ZonedDateTime.now().plusMinutes(1), function(){
    events.sendCommand("GP_Gesamtes_Licht_Wohnung", OFF);
  });
}

I am not really sure what the line (coming from your hint) this.pufferTimer = (this.pufferTimer === undefined) ? null : this.pufferTimer; should do for me here. In my own words I think that it will check if a Timer is already running, if yes it will be kept and if no (because it already ran) it will be “nulled”. But what I need is a Timer reset.

So what I tried to do is to check if a Timer is already running. If yes it is cancelled and if no it just goes on and creates a timer.
It is basically a simple “leaving home” rule with a short buffer.

Did I do the right thing here?

EDIT: It seems to work…