5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 00:06:21 +00:00
panel/app/models/metadata_document_date.rb
2019-08-13 20:52:05 -03:00

18 lines
353 B
Ruby

# frozen_string_literal: true
# Maneja la fecha del document
class MetadataDocumentDate < MetadataTemplate
# La fecha por defecto es ahora!
def default_value
Date.today.to_time
end
def value
self[:value] || document.date || default_value
end
def value=(date)
date = date.to_time if date.is_a? String
super(date)
end
end