Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def prepare_value(self, value):
if isinstance(value, datetime_date):
date_obj = GregorianToJalali(gyear=value.year, gmonth=value.month, gday=value.day)
return '%d-%.2d-%.2d' % (date_obj.jyear, date_obj.jmonth, date_obj.jday)
return value
def decompress(self, value):
if value:
value = to_current_timezone(value)
j_date_obj = GregorianToJalali(gyear=value.year, gmonth=value.month, gday=value.day)
date_str = '%d-%.2d-%.2d' % (j_date_obj.jyear, j_date_obj.jmonth, j_date_obj.jday)
return [date_str, value.time().replace(microsecond=0)]
return [None, None]