mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 00:06:21 +00:00
18 lines
353 B
Ruby
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
|