mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
[ruby/psych] Format Date in ISO-8601 explicitly
Fix https://github.com/ruby/psych/pull/644
b1ade765ba
This commit is contained in:
parent
5adb2591da
commit
49d49d5985
2 changed files with 21 additions and 1 deletions
|
@ -189,7 +189,8 @@ module Psych
|
|||
end
|
||||
|
||||
def visit_Date o
|
||||
register o, visit_Integer(o.gregorian)
|
||||
formatted = format_date o
|
||||
register o, @emitter.scalar(formatted, nil, nil, true, false, Nodes::Scalar::ANY)
|
||||
end
|
||||
|
||||
def visit_DateTime o
|
||||
|
@ -486,6 +487,10 @@ module Psych
|
|||
end
|
||||
end
|
||||
|
||||
def format_date date
|
||||
date.strftime("%Y-%m-%d")
|
||||
end
|
||||
|
||||
def register target, yaml_obj
|
||||
@st.register target, yaml_obj
|
||||
yaml_obj
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue