Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when serializing date string with non-space whitespace character #691

Open
kkan opened this issue Oct 16, 2024 · 0 comments
Open

Error when serializing date string with non-space whitespace character #691

kkan opened this issue Oct 16, 2024 · 0 comments

Comments

@kkan
Copy link

kkan commented Oct 16, 2024

string = "2023-12-30\t23:16:25"
Psych.dump(string)
/.rbenv/versions/3.2.2/lib/ruby/3.2.0/psych/scalar_scanner.rb:120:in `parse_time': undefined method `match' for nil:NilClass (NoMethodError)

      md = time.match(/(\d+:\d+:\d+)(?:\.(\d*))?\s*(Z|[-+]\d+(:\d\d)?)?/)

Happens because \s is used in TIME regex, and space is used when splitting string into date and time

string.match?(Psych::ScalarScanner::TIME) # true
date, time = *(string.split(/[ tT]/, 2)) # ["2023-12-30\t23:16:25"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant