Fixes in dates

This commit is contained in:
Antonio de la Rosa 2025-07-05 02:08:19 +02:00
parent 833e3219ea
commit 4d82ddced0
3 changed files with 56 additions and 25 deletions

View file

@ -77,6 +77,7 @@ class DateTimeField(PhangoField):
def show_formatted(self, value):
# Convert to paramecio value
value=str(value)
value=value.replace('-', '').replace(':', '').replace(' ', '')

View file

@ -35,23 +35,36 @@ class DateForm(BaseForm):
def form(self):
y=''
m=''
d=''
h=''
min=''
s=''
min_time=''
if type(self.default_value).__name__!='datetime':
time=format_timedata(self.default_value)
y=''
m=''
d=''
h=''
min=''
s=''
min_time=''
time=format_timedata(self.default_value)
if time[0]:
y=int(time[0])
m=int(time[1])
d=int(time[2])
h=int(time[3])
min_time=int(time[4])
s='00' #int(time[5])
if time[0]:
y=int(time[0])
m=int(time[1])
d=int(time[2])
h=int(time[3])
min_time=int(time[4])
s=int(time[5])
else:
y=self.default_value.year #"{:>10}".format(s)
m="{:02d}".format(self.default_value.month)
d="{:02d}".format(self.default_value.day)
h="{:02d}".format(self.default_value.hour)
min_time="{:02d}".format(self.default_value.minute)
s='00'
pass
return self.t.load_template('forms/dateform.phtml', yes_time=self.yes_time, form=self.name, y=y, m=m, d=d, h=h, min=min_time, s=s)