Datepicker to allow 2 date format
Is it possible to allow two date format specifically just the zeros for month and day?
E.g.:
01/01/2015 1/01/2015 01/1/2015 1/1/2015
Please do not use the issues forum for support related requests. Rather, please follow the instructions here.
See this SO article for your answer.
I'm reopening this as it needs further investigation. <input type="date"/> is not supported in all browsers so we support type="text" to mitigate.
What would help is if you could create a bare bones plunker using the latest code to demonstrate this issue. That should help get us started. Thanks.
@icfantv here you go: http://plnkr.co/edit/NPqifjimoAnuJgvFPyDm?p=preview
I put both MM/dd/yyyy and M/d/yyyy text boxes.
Linking in the SO article here: http://stackoverflow.com/questions/32832161/angular-bootstrap-how-to-allow-2-different-date-format
Quick question, where would be the appropriate place to add a clarification/feature request that's related to this issue?
@icfantv not sure what you have in mind for a fix. One solution came to mind is to enforce formatting on blur. Not sure if that is acceptable solution/method.
I need to talk to the other devs about the right fix here assuming that it is a bug (I freely admit I have not yet investigated it). Currently we're focused on getting 0.14.0 out the door and getting ng-bootstrap (the ng2/BS4 port) ready for Angular Connect, London in a few weeks.
We have weekly meetings on Tuesdays and I will bring it up then. Thanks.
To implement this, this would involve modifying the uibDateParser service - we may be able to support this, but this is work that would be scheduled for backlog, and likely only implemented if someone submitted a high quality PR.
One needs to be careful about the letters chosen to support double date formats. We follow the native dateFilter in Angular, so any choice cannot conflict with this.
@wesleycho So one thing that is desperately needed is the ability to databind to a date format that is different than what is displayed. For example, binding to a datetime in ISO, then displaying simple mm/dd/yyyy.
That is separate from this issue and should be in a separate issue if that is requested - we removed string support though due to cross-browser issues, so that particular proposal is a no-go.
In 0.13.1 (and earlier, probably), the text box accepted many date formats as typed in by the user. Starting in 0.13.2, it accepts only the date format specified in datepicker-popup. You can reproduce this in the docs - scroll down to the 0.13.1 datepicker demo here and enter 1/1/17 or 2017-01-01 or jan 1 17 and it works. Try that in the 0.13.2 or later datepicker demo, and it doesn't work, unless you use the format specified in datepicker-popup. Was it intentional to remove this functionality?
This was intentional - this was due to unexpected cross-browser issues that were impossible to fix.
This feature is now supported in master via b1cfc57
Many thanks for the fix, we struggled with the same issue. Is there an approximate date we can expect this fix in a (npm) release?
@brunnurs, the 1.x release will be soon. In the interim, you can pull master and do a SNAPSHOT build.
@icfantv Thanks for the V1.0.3 release, which includes the new feature. Unfortunately, it doesn't seem to work with the uib-datepicker-popup.
I extended your plunkr with the format d!.M!.yyyy. I expected to be able to enter a date in format 13.01.2016 OR 13.1.2016. But it doesn't seem to work. Is it a bug or my rookie-mistake?
@brunnurs, if you think you've found a bug, please follow these instructions.
In practice, it's never a good idea to ask for help on a closed thread. Doing so is a good way for it to get missed or ignored.