I am trying to push +1 hour into my datetime picker using a button but having great difficulty, i know this component has its own functionality for that but my boss requested this.
The problem I’m having is getting the value of the datetime picker inside my script, so I can manipulate it based on whichever datetime is selected on it.
this is my code.
import datetime as DT
from datetime import date
from datetime import datetime
self.session.custom.hour = self.session.custom.hour + 1
current = self.getSibling("DateTimeInput").props.value #datetime.now()
minushour = current - DT.timedelta(hours= self.session.custom.hour)
self.getSibling("DateTimeInput").props.value = minushour
you’ll noticed the hashed out datetime.now(), if I have this alone as the value of ‘current’ the script runs fine but the problem being it will set the datetime picker to the current time minus whatever hour, instead of keeping the selected datetime and minusing one hour from that value. (i hope i explained that coherently)
the error i get is this
I believe this is saying I cannot use any timedelta script onto my datetime picker components value because it isn’t a properly formatted datetime like datetime.now() is
If anybody could help me with this or confirm that it is impossible I would appreciate it.