-
Notifications
You must be signed in to change notification settings - Fork 13
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
What's the "am-date-format" code/value for mm/dd/yyyy (e.g., 01/24/2016)? #10
Comments
To set up format for displayed date in the input you should use <am-date-picker am-input-date-format="MM/DD/YYYY"></am-date-picker> For available formats see moment.js |
Found the reason why: The CodePen.io example (the 3rd at the bottom) uses am-date-format="L" (which I used earlier), not am-input-date-format (which is the current key used). |
@unmade - Quick question: I was using the official Angular Material "md-datepicker" previously, but my client doesn't like it and wants something close to the Material Design spec, like what you created. "md-datepicker" allows me to use "ng-change", to which I can attach a change handler function to intercept the new date value when the user selects a new date. What is the best, most efficient way to handle date selection that's close to what *ng-change" offers? Thanks for your reply, and I hope you won't get tired responding to our questions. |
Sorry, my bad. I guess, I forgot to update the codepen after the attr's name was changed. As for the For now, you could handle date selection by adding a watcher in your controller (but it is not recommended). |
@unmade - That would be really nice! And yes, I think attaching 'ng-change' to the 'OK' button (for confirming date selection by the user) is the way to go. As for attaching 'ng-change' to clicks outside the dialog: I believe a click outside the dialog is equivalent to clicking 'Cancel', which 'cancels' any date selection and retains the old value in the date field. (By the way, the current implementation when the user presses a date in the calendar is to immediately update the value in the date field. Wouldn't it be better if the field-value update is done only when the user presses the 'OK' button, and that any other action (e.g., pressing 'Cancel' or clicking outside the dialog) cancels any date selection and retains the old value in the field? What do you think?) Appreciate it! |
I update the master branch. Check out the demo and the API documentation. Any feedback highly appreciated. |
@unmade, that was fast! Thank you also for listening to our ideas and for being responsive. Also, if you don't mind, I have another suggestion for improvement: The official Angular Material datepicker component can be displayed ON TOP of a dialog component. This is an important feature when we use a dialog with form inputs that include a date input (setting/selecting a date from the datepicker). Is this something you can implement soon? I actually need it now for an application I'm working on, but I can wait for 2-3 days if you can't do it in a day or immediately. Thanks again, appreciate it! |
Thank you! I'm sorry, but for now I'm not planning to implement it. As long as I'm using |
@unmade - Oh, okay, I understand it's not a simple thing to do. I hope, though, that you'll find time to implement it like the standard Angular Material datepicker (i.e., use it on a form in an $mdDialog). |
I see only "L" and "LL" being used (for Long date). What's the code to use for "01/24/2016"?
The text was updated successfully, but these errors were encountered: