-
-
Notifications
You must be signed in to change notification settings - Fork 776
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
how to not parse date-looking-strings as dates, but as strings? #161
Comments
There are two ways.
var SCHEMA = yaml.Schema.create(yaml.CORE_SCHEMA, [ /* additional types */ ]) |
For reference, I was able to get it working like this: var YAML = (window.jsyaml || require('js-yaml'))
, schema
;
schema = YAML.Schema.create(YAML.CORE_SCHEMA, []);
YAML.load('date: 2006-03-06 06:38:00 -07:00', { schema: schema }); |
My two cents. IMHO strings in YAML should be strings. If you need to have something that might be interpreted as non-string but you need it to be string, either explicitly set type, or implicitly (use quotes): ---
explicit: !!str 2015-02-03
implicit: "2015-02-03" |
cmil
added a commit
to dracor-org/einakter
that referenced
this issue
Oct 29, 2020
This prevents date strings to be converted to Date object which is an unwanted side effect broke the normalizeYear function. see nodeca/js-yaml#161 resolves #17
2 tasks
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to turn off the datetime parsing?
I have a bunch of date and time strings, but they're meant for literal presentation as strings, not for interpretation as date objects.
The text was updated successfully, but these errors were encountered: