scinote-web/app/models/repository_date_time_value.rb

18 lines
400 B
Ruby
Raw Normal View History

2019-11-18 22:21:57 +08:00
# frozen_string_literal: true
2019-12-06 19:50:19 +08:00
class RepositoryDateTimeValue < RepositoryDateTimeValueBase
def data_changed?(new_data)
formatted != formatted(new_date: new_data)
end
def formatted(new_date: nil)
super(:full_with_comma, new_date: new_date)
end
def self.new_with_payload(payload, attributes)
value = new(attributes)
value.data = Time.zone.parse(payload)
value
end
2019-11-18 22:21:57 +08:00
end