Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatePicker Format #2302

Open
sgentile opened this issue Apr 11, 2018 · 8 comments
Open

DatePicker Format #2302

sgentile opened this issue Apr 11, 2018 · 8 comments

Comments

@sgentile
Copy link

@sgentile sgentile commented Apr 11, 2018

I do not see an option in the datepicker for setting the display format ? It appears to only support yyyy-mm-dd , whereas I need to be able to set it to mm/dd/yyyy ?

@pkozlowski-opensource
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource commented Apr 11, 2018

There is no option to just set a format but you can introduce any display / parse format by implementing https://github.com/ng-bootstrap/ng-bootstrap/blob/master/src/datepicker/ngb-date-parser-formatter.ts#L9

@sgentile
Copy link
Author

@sgentile sgentile commented Apr 12, 2018

ok, no offense but that seems rather complex for just wanting to have a display and value format ? Is there any example of using this ? Thank you

@pkozlowski-opensource
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource commented Apr 12, 2018

no offense but that seems rather complex for just wanting to have a display and value format

That's the best we've got for now, I'm afraid. This is why I've marked this as a feature request.

And just to be clear - it is not only about displaying a formatted date (which is trivial using built-in pipes) - it is also about parsing a date string as entered by a user (which is not trivial and this is why it is not implemented).

We would highly appreciate people in the need of this feature to step in and write a general-purpose parser for dates entered by users!

@tech-no-logical
Copy link

@tech-no-logical tech-no-logical commented Apr 24, 2018

@dadoadk
Copy link

@dadoadk dadoadk commented May 22, 2019

This is a disappointment that in 2019 anybody would accept the overly complicated solution to a seemingly trivial problem. For the past 12 years, many frameworks and libraries included an easy way of displaying dates and using all sorts of formats and masks. This team decided to rather implement NgbDateParserFormatter class than to simply provide a solution to formatting a string representing a date. This directive should come with "format" attribute taking a string for 3 or more basic date formats and move on. Please prioritize.
P.S. Who's idea was to use object {year:0,month:0,day:0} when there's an ISO standard for Date objects in javascript?

@eduebrasil
Copy link

@eduebrasil eduebrasil commented May 22, 2019

This is a disappointment that in 2019 anybody would accept the overly complicated solution to a seemingly trivial problem. For the past 12 years, many frameworks and libraries included an easy way of displaying dates and using all sorts of formats and masks. This team decided to rather implement NgbDateParserFormatter class than to simply provide a solution to formatting a string representing a date. This directive should come with "format" attribute taking a string for 3 or more basic date formats and move on. Please prioritize.
P.S. Who's idea was to use object {year:0,month:0,day:0} when there's an ISO standard for Date objects in javascript?

I'm not a contributor myself but I think everybody is free to send a PR and propose improvements. That's the beauty of github open projects.

@dadoadk
Copy link

@dadoadk dadoadk commented May 22, 2019

Did a person who worked on this got a lottery or died so they cannot see these issues still being discussed? Last time anybody from contributors team looked at this issue was in 2018. They can give us some hints on where and how to fix this thing.

@randym127
Copy link

@randym127 randym127 commented Aug 13, 2019

I have multiple date pickers with multiple formats... This only works with 1 and only 1 format, or I have to create a factory for each and every format..

God I wish we would have picked anything other than bootstrap...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.