-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datetime): default to now or max. Fixes #9846
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
559f4d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Max,
Having a max value defined should only influence the default value if the max value is in the past. The default value should be now if the max value is in the future.
Thanks
559f4d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Simpler1 there's an issue, max should be the current if it's before current, but not if it's after. Fix incoming
559f4d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect. Thanks
559f4d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Max, please reread this issue because this fix doesn't address what I think most of us are looking for.
We are specifically trying to avoid this. Just as you wouldn't default a name field to "John Doe" and expect users to change it, you shouldn't have to default to a date and expect them to change it.
I'm struggling to think of why this would be useful. How many scenarios are there where the max date would be the most likely / closest to what the user wants to enter? If anything, the current date should override min or max.
Which brings us back to what we really want; a
pickerPlaceholder
. We want to set a date for the picker to open to in order to minimize the amount of fiddling the user has to do with the picker dials.559f4d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, those changes add in a different requested feature to set the default to some sane value which should be the current time. Will make another set of changes to make it possible to set the default
559f4d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @PatrickMcD all we want is an new attribute like
placeholder
which can be set to any date that the developer wishes to. Almost all UI frameworks like Angular-UI, Bootstrap have aplaceholder
attribute for date/time picker in addition tongModel
orpicker-value
.559f4d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shyamal890 https://twitter.com/Shyamal890/status/913673840340869121
I took this to mean the picker should default to the current time when opened if nothing else was specified. Those commits add this feature which it seems we should have had anyways.
Next is to do a default value you can specify.
559f4d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, I actually meant to convey the following (Point 1):
Currently when a user opens date-picker the default is
1 Jan 2017
and current date is29 Sept 2017
, even if a user wants to change to tomorrow's date, it takes a lot of efforts. That is where an attribute likeplaceholder
would help the developers. In which case whenever the date-picker is opened,placeholder
attribute wouldACTIVATE
current date (ngModel
shouldn't be modified) and the user wouldn't have to scroll a lot.If user opens up the
date picker
, and decides not to select any date, with current commitngModel
would be set to current date which again is a bad UX design.ngModel
shouldn't be updated until the user clicks onDone
button. (Assuming I am right in my understanding of what the latest commit aims to achieve)559f4d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked on Angular-UI site. Here's the attribute name and it's functionality:
I guess
initDate
is a much better name thanplaceholder
as placeholder may seem limited to input control and not extend to datepicker. Moreover, the following part is the most important one:initial date view when no model value is specified