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

@ -1,38 +1,55 @@
${add_js('jquery.min.js', 'admin')}
<input type="number" min="1" max="31" name="${form}_day" id="time_${form}_day" class="form_day" value="${d}" size="2" maxlength="2"/>
<!--<input type="number" min="1" max="31" name="${form}_day" id="time_${form}_day" class="form_day" value="${d}" size="2" maxlength="2"/>
<input type="number" min="1" max="12" name="${form}_month" id="time_${form}_month" class="form_month" value="${m}" size="2" maxlength="2"/>
<input type="number" name="${form}_year" id="time_${form}_year" class="form_year" value="${y}" size="4" maxlength="4"/>
<input type="number" name="${form}_year" id="time_${form}_year" class="form_year" value="${y}" size="4" maxlength="4"/>-->
<%
date=''
if d!='':
date='-'.join((str(y), str(m), str(d)))
time=''
if h!='':
time=':'.join((str(h), str(min)))
%>
${date}
<input type="date" value="${date}" name="${form}_date" id="${form}_date" />
% if yes_time==True:
<input type="number" min="0" max="23" name="${form}_hour" id="time_${form}_hour" class="form_hour" value="${h}" size="2" maxlength="2"/>
<!--<input type="number" min="0" max="23" name="${form}_hour" id="time_${form}_hour" class="form_hour" value="${h}" size="2" maxlength="2"/>
<input type="number" min="0" max="60" name="${form}_minute" id="time_${form}_minute" class="form_minute" value="${min}" size="2" maxlength="2"/>
<input type="number" min="0" max="60" name="${form}_second" id="time_${form}_second" class="form_second" value="${s}" size="2" maxlength="2"/>
<input type="number" min="0" max="60" name="${form}_second" id="time_${form}_second" class="form_second" value="${s}" size="2" maxlength="2"/>-->
<input type="time" value="${time}" name="${form}_time" id="${form}_time" />
% endif
<input type="hidden" name="${form}" id="time_${form}" value="" />
<script language="javascript">
$(document).submit(function () {
year=$("#time_${form}_year").val().toString();
/*year=$("#time_${form}_year").val().toString();
month=$("#time_${form}_month").val().toString();
day=$("#time_${form}_day").val().toString();
year=add_extra_length(year, 4);
month=add_extra_length(month, 2);
day=add_extra_length(day, 2);
day=add_extra_length(day, 2); */
final_time=year+month+day
//final_time=year+month+day
final_time=$('#${form}_date').val().replace(/-/g, '');
% if yes_time==True:
hour=$("#time_${form}_hour").val().toString();
/*hour=$("#time_${form}_hour").val().toString();
minute=$("#time_${form}_minute").val().toString();
second=$("#time_${form}_second").val().toString();
hour=add_extra_length(hour, 2);
minute=add_extra_length(minute, 2);
second=add_extra_length(second, 2);
second=add_extra_length(second, 2); */
final_time+=final_time;
final_time+=$('#${form}_time').val().replace(':', '')+'00';
% else: