Skip to content

Date.toLocaleString contains invalid delimiter character #45753

@stsoib

Description

@stsoib

Version

v18.12.1+1-b20221130T14204672

Platform

Linux osrvdv-rr-441 3.10.0-957.35.2.el7.x86_64 #1 SMP Wed Sep 18 05:51:28 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Run this script:

#!/usr/bin/env node

const os = require('os')

console.log('Operating System\n', os.platform(), os.release())
console.log('Node JS Version\n', process.version)

const str = new Date().toLocaleString({ locale: 'en-US' })
console.log(`String value of', 'new Date().toLocaleString({ locale: 'en-US' })\n`, `"${str}"`)
console.log('Char value at position 18\n', `"${str.charAt(18)}"`)
console.log('Char code at position 18\n', str.charCodeAt(18))

On Linux I see:

CaptureA

On Windows I see:

CaptureB

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

Delimiter of en-US should just be regular whitespace, and this should be consistent across operating systems.

What do you see instead?

CaptureC

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions