mirror of
https://github.com/docusealco/docuseal
synced 2026-11-06 23:12:33 -05:00
parse date using format
This commit is contained in:
1 parent
7568f563cb
commit
1289aff493
2 files changed
+11
-1
No files matched your search
@@ -56,7 +56,9 @@ module Submitters
|
||||
(value.to_f % 1).zero? ? value.to_i : value.to_f
|
||||
elsif field['type'] == 'date' && value.present? && value != '{{date}}'
|
||||
if value.is_a?(Integer)
|
||||
Time.zone.at(value.to_s.first(10).to_i).to_date
|
||||
Time.zone.at(value.to_s.first(10).to_i).to_date.to_s
|
||||
elsif value.gsub(/\w/, '0') == field.dig('preferences', 'format').to_s.gsub(/\w/, '0')
|
||||
TimeUtils.parse_date_string(value, field.dig('preferences', 'format')).to_s
|
||||
else
|
||||
Date.parse(value).to_s
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user