globalizejs / globalizejs/globalize
Expose the localized date format used by dateParser
- Dominant language
- JavaScript
- Stars
- 4.8k
- Forks
- 585
- PR merge metrics
- No merged PRs in 30d
Description
I need to show the LOCALIZED format string as a guidance to users entering values into textboxes.
In my case I need this for dates, and I was able to find a "hack" as follows:
```typescript
const parser = Globalize.dateParser(options);
const format: string = parser.runtimeArgs[2].pattern;
// 'format' variable will be different for different locales when options are same
// locale "en-US" with options { skeleton: 'yyyyMMdd' } => 'MM/dd/yyyy'
// locale "en-UK" with same options => 'dd/MM/yyyy'
```
But when running the application after uglifying my scripts in the webpack optimized build, the runtimeArgs propery of the parser is undefined. I guess this runtimeArgs property was not meant to be exposed to the outside world anyway.
Is there some other way that I can get this, or could you potentially consider this a feature request?
Contributor guide
Assessment
This issue has not been assessed yet.