yaml.js icon indicating copy to clipboard operation
yaml.js copied to clipboard

Incorrect handling of datetime keys

Open adius opened this issue 7 years ago • 0 comments

yaml.parse(
`2016-01-01 12:34:56.789: foo
2016-01-02 12:34:56.789: bar
`)

and

yaml.parse(
`? 2016-01-01 12:34:56.789
: foo
? 2016-01-02 12:34:56.789
: bar
`)

yield

{
  'Fri Jan 01 2016 12:34:56 GMT+0000 (UTC)': 'foo',
  'Sat Jan 02 2016 12:34:56 GMT+0000 (UTC)': 'bar'
}

but should yield

new Map([
  [new Date('2016-01-01T12:34:56.789Z'): 'foo'],
  [new Date('2016-01-02T12:34:56.789Z'): 'bar']
])

… or at least

{
  '2016-01-01T12:34:56.789Z': 'foo',
  '2016-01-01T12:34:56.789Z': 'bar'
}

or

{
  '2016-01-01 12:34:56.789': 'foo',
  '2016-01-01 12:34:56.789': 'bar'
}

adius avatar Nov 26 '16 15:11 adius