dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

Fall back relative time to english if cant find loaded locale

Open lkostrowski opened this issue 5 years ago • 2 comments

Currently dayjs is not actually "safe" in terms of usage.

I know there is a goal of keeping size limit, however maybe there is a reasonable way to improve code quality and move code compiling to some super-minifier like Closure compiler, without omitting code security and overall readability (variable names etc)?

In this PR I do fallback to english locale in relativeTime plugin, which throws without reasonable message if locale isn't loaded properly. I also show error in console. I have expected behavior like this since I failed loading language in my project and it didn't inform me about it.

Don't know if this is something expected in this library or it's very "raw" deliberately

lkostrowski avatar Oct 25 '19 18:10 lkostrowski