System.date.now() crashes binding

This error happens on two of my views and it happens sporadically, the binding will persist to being null even when the propertybinding value changes but the binding preview will not error out. Any ideas on why a system.date.now() would error out like this

What's going on over yonder? That's 'None' right?

Not sure why that is giving you a problem, but why not use the timestamp that's already given to you in the transform?

Correct that is None, but i dont believe that is causing the error as i have the same error on another screen where the line that errors is strictly: now = system.date.now()

1 Like

Your transform could be simplified to just this also:

return value > system.date.now() and self.view.custom.newStatus != None
2 Likes

You could also replace this with an expression binding:

view.custom.dateTimePickerValues.selectedDateTime > now() && self.view.custom.newStatus != null
1 Like

When it's giving you the error, what is the selectedDateTime value? Is it null and maybe just giving a misleading error?

Yeah I switched it to a
from datetime import datetime
today = datetime.now()
and i cant replicate the error again but i mainly was concerned about the date.now because ive used it a lot in the past and was worried if this would continue to popup errors

I would use the expression, but if you want the transform you already have a timestamp provided.
image

if value > timestamp and ...:
    return True
1 Like

Ughh .. that's an anti pattern.

IMHO you should

return (value > timestamp and ...)

2 Likes

I was just correcting what he was already using so it would be clear. :man_shrugging:

1 Like