fix: 如果结束时间为0点则取开始时间来返回年月日

This commit is contained in:
caoqianming 2024-04-30 18:20:31 +08:00
parent 69db9db180
commit a6914413f7
1 changed files with 4 additions and 1 deletions

View File

@ -38,7 +38,10 @@ class SfLog(CommonADModel):
"""
返回值班记录所属年月日
"""
end_time_local = localtime(self.end_time)
end_time = self.end_time
if end_time.minute == 0 and end_time.second == 0 and end_time.hour == 0: # 如果结束时间为00:00:00
end_time = self.start_time
end_time_local = localtime(end_time)
return end_time_local.year, end_time_local.month, end_time_local.day