bleenco/ng2-datepicker

Locale object

Opened this issue · 12 comments

How should looks locale object to work with datepicker?

I want to add my lang (ukrainian). It's aviable in last version of date-fns, but this datepicker doesn't work with it.

So i want to add my own locale file. How should it looks like?

jkuri commented

I checked and date-fns is the latest version available. You have a clear example in the README how to use it.

@jkuri you have tried last version of datepicker(2.2.2) and last version of date-fns(2.0.0-alpha.7) and languages switches correctly?

jkuri commented

we won't use date-fns alpha version but a stable release.

@jkuri in stable release there is no ukrainian language. It is available only in version 2
and in readme file there is no info about adding/using new languages for options.locale.

jkuri commented

okay I see.. you can still solve this by manually copying https://github.com/date-fns/date-fns/tree/v2.0.0-alpha.7/src/locale/ua folder into your application then import it from there.

@jkuri i have tried this way and it didn't work for me. i get different errors. I copied folder from date-fns v1.
i will try one more time and show you an error.

jkuri commented

okay. maybe the translations format is not same for v1 and v2 and you'll need to add translations by your own. try copying English example as a case from v1 then manually translate to Ukrainian.

@jkuri i will get an error(somethig about like 'this is not a module'). one minute. i'm on my way to do this.

I've copied ru folder as example and got an error. File '/src/typings.d.ts' is not a module.

jkuri commented

that is really weird. do you use angular-cli or which tool? can you append me an example app as a .zip here, just drag&drop here without node_modules/ in a comment and I will take a look.

@jkuri yes, angular-cli. project... i will try to give you needed part. couple minutes. maybe i will solve problem with last error.

solved by adding copy of this module v1.28.1 into my nexus repo. also i've added folder ua into locale.