fix error

This commit is contained in:
BoHung Chiu 2023-04-20 21:17:36 +08:00
parent 0b86a3b205
commit d910d3d99b
3 changed files with 5 additions and 5 deletions

View File

@ -81,7 +81,7 @@ class Admin::RulingTimersController < OrbitMemberController
end
end
def get_user_timer_data(user, display_name = false)
time_now = DateTime.now.utc.new_offset("+8")
time_now = DateTime.now.new_offset("+08:00")
now_year_month = time_now.strftime("%Y/%m")
@start_year_month = params[:start_year_month].present? ? DateTime.parse(params[:start_year_month]).utc : time_now
@end_year_month = params[:end_year_month].present? ? DateTime.parse(params[:end_year_month]).utc : time_now

View File

@ -35,7 +35,7 @@ class RulingTimerProject
end
end
before_create do |record|
time_now = record.created_at || DateTime.now.utc.new_offset(record.time_offset)
time_now = record.created_at || DateTime.now.new_offset(record.time_offset)
today_start = DateTime.parse("#{time_now.strftime("%Y/%m/%d")} 00:00:00#{record.time_offset}").utc
today_end = DateTime.parse("#{(time_now + 1.day).strftime("%Y/%m/%d")} 00:00:00#{record.time_offset}").utc
today_project_count = record.class.where(:created_at.gte=>today_start,:created_at.lt=>today_end).count
@ -58,7 +58,7 @@ class RulingTimerProject
end
end
def create_time
convert_datetime(self.created_at.utc).new_offset(self.time_offset).strftime("%Y/%m/%d %H:%m")
convert_datetime(self.created_at).new_offset(self.time_offset).strftime("%Y/%m/%d %H:%m")
end
def users
User.where(:id.in=>self.user_ids)

View File

@ -47,7 +47,7 @@ class RulingTimerTask
end
end
before_create do |record|
time_now = record.created_at || DateTime.now.utc.new_offset(record.time_offset)
time_now = record.created_at || DateTime.now.new_offset(record.time_offset)
today_start = DateTime.parse("#{time_now.strftime("%Y/%m/%d")} 00:00:00#{record.time_offset}").utc
today_end = DateTime.parse("#{(time_now + 1.day).strftime("%Y/%m/%d")} 00:00:00#{record.time_offset}").utc
today_task_count = record.class.where(:created_at.gte=>today_start,:created_at.lt=>today_end).count
@ -147,7 +147,7 @@ class RulingTimerTask
end
end
def create_time
convert_datetime(self.created_at.utc).new_offset(self.time_offset).strftime("%Y/%m/%d %H:%m")
convert_datetime(self.created_at).new_offset(self.time_offset).strftime("%Y/%m/%d %H:%m")
end
def users
User.where(:id.in=>self.user_ids)