bleenco / ng2-datepicker

Angular2 Datepicker Component
http://ng2-datepicker.jankuri.com
MIT License
311 stars 236 forks source link

Locale object #299

Open MerkulovDev opened 6 years ago

MerkulovDev commented 6 years ago

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 6 years ago

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

MerkulovDev commented 6 years ago

@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 6 years ago

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

MerkulovDev commented 6 years ago

@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 6 years ago

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.

MerkulovDev commented 6 years ago

@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 6 years ago

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.

MerkulovDev commented 6 years ago

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

MerkulovDev commented 6 years ago

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

jkuri commented 6 years ago

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.

MerkulovDev commented 6 years ago

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

MerkulovDev commented 6 years ago

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