ng-lightning / ng-lightning

Native Angular components & directives for Lightning Design System

Home Page:http://ng-lightning.github.io/ng-lightning/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make the NglDateAdapter an injection token

jasedwards opened this issue · comments

My enterprise application has to support over 200 cultures. Because of this there is no reasonable way for me to use the date picker with the current formatting options (I cannot translate a culture set at runtime to something like big-endian). Currently I grab the users date format based on culture from the server (.net) and bring that down when loading the app. this allows me to easily parse/format a date. If this adapter was made an injection token and you just injected an interface I could create my own adapter. This would also be a way to solve handling any format a user would like when using your control. The required change would be

datepicker-input.ts

@Inject(NGL_DATE_ADAPTER) adapter: INglDateAdapter

datepickers.module.ts

providers: [{provide: NGL_DATE_ADAPTER, useClass NglDateAdapter}]