Hi everyone,
I'm trying to separate overtime and contract hours in the attendance module, but it seems that dates are saved in UTC in the database. Is it possible to use pytz to convert datetimes to the user timezone?
When trying:
for rec in records:
context_tz = pytz.timezone(rec.env.user.tz)
log(rec.check_in.astimezone(context_tz).strftime('%A, %y-%m-%d %H-%M'), level='info')
log(rec.env.user.tz, level='info')
I get:
ValueError: <class 'NameError'>: "name 'pytz' is not defined" while evaluating
And if I try to "import pytz", I get:
Validation Error
forbidden opcode(s) in '# Available variables:\n# - env: (...)
Any idea on how to approach this?
Thanks!