This repository was archived by the owner on Sep 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/components/datepicker Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ md-datepicker.md-THEME_NAME-theme {
8
8
9
9
.md-datepicker-input-container {
10
10
border-bottom-color : ' {{background-300}}' ;
11
+
12
+ & .md-datepicker-invalid {
13
+ border-bottom-color : ' {{warn-500}}' ;
14
+ }
11
15
}
12
16
13
17
.md-datepicker-calendar-pane {
Original file line number Diff line number Diff line change 9
9
// TODO(jelbourn): make sure this plays well with validation and ngMessages.
10
10
// TODO(jelbourn): calendar pane doesn't open up outside of visible viewport.
11
11
// TODO(jelbourn): forward more attributes to the internal input (required, autofocus, etc.)
12
- // TODO(jelbourn): error state
13
12
// TODO(jelbourn): something better for mobile (calendar panel takes up entire screen?)
14
13
// TODO(jelbourn): input behavior (masking? auto-complete?)
15
14
// TODO(jelbourn): UTC mode
86
85
/** Additional offset for the input's `size` attribute, which is updated based on its content. */
87
86
var EXTRA_INPUT_SIZE = 3 ;
88
87
88
+ /** Class applied to the container if the date is invalid. */
89
+ var INVALID_CLASS = 'md-datepicker-invalid' ;
90
+
89
91
/**
90
92
* Controller for md-datepicker.
91
93
*
214
216
215
217
if ( self . dateUtil . isValidDate ( parsedDate ) && self . dateLocale . isDateComplete ( inputString ) ) {
216
218
self . ngModelCtrl . $setViewValue ( parsedDate ) ;
219
+ self . inputContainer . classList . remove ( INVALID_CLASS ) ;
217
220
self . $scope . $apply ( ) ;
221
+ } else {
222
+ // If there's an input string, it's an invalid date.
223
+ self . inputContainer . classList . toggle ( INVALID_CLASS , inputString ) ;
218
224
}
219
225
} ) ;
220
226
} ;
You can’t perform that action at this time.
0 commit comments