mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Rename timezone attribute and add it to local date details field
This commit is contained in:
@ -27,9 +27,10 @@ after_initialize do
|
||||
dates = doc.css('span.discourse-local-date').map do |cooked_date|
|
||||
date = {}
|
||||
cooked_date.attributes.values.each do |attribute|
|
||||
if attribute.name && ['data-date', 'data-time'].include?(attribute.name)
|
||||
data_name = attribute.name&.gsub('data-', '')
|
||||
if data_name && ['date', 'time', 'timezone'].include?(data_name)
|
||||
unless attribute.value == 'undefined'
|
||||
date[attribute.name.gsub('data-', '')] = CGI.escapeHTML(attribute.value || "")
|
||||
date[data_name] = CGI.escapeHTML(attribute.value || "")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user