mirror of
https://github.com/docusealco/docuseal
synced 2026-11-08 07:42:32 -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
@@ -32,6 +32,14 @@ module TimeUtils
|
||||
tz_info.abbreviation(time)
|
||||
end
|
||||
|
||||
def parse_date_string(string, pattern)
|
||||
pattern = pattern.sub(/Y+/, YEAR_FORMATS)
|
||||
.sub(/M+/, MONTH_FORMATS)
|
||||
.sub(/D+/, DAY_FORMATS)
|
||||
|
||||
Date.strptime(string, pattern)
|
||||
end
|
||||
|
||||
def format_date_string(string, format, locale)
|
||||
date = Date.parse(string.to_s)
|
||||
|
||||
|
||||
Reference in new issue
Block a user