Skip to content

Commit 0e3b6d3

Browse files
author
kylegerber94
authored
Previous commit broke validation. Fixed.
1 parent 2423a6b commit 0e3b6d3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pmp-simple-date-input.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@
9090
<label hidden$="[[!label]]" slot="label">[[label]]</label>
9191

9292
<iron-input bind-value="{{value}}" slot="input"
93+
id="input"
9394
maxlength$="[[maxlength]]"
9495
allowed-pattern="[0-9\/]"
9596
invalid="{{invalid}}">
96-
<input id="input"
97+
<input
9798
aria-labelledby$="[[_ariaLabelledBy]]"
9899
aria-describedby$="[[_ariaDescribedBy]]"
99100
disabled$="[[disabled]]"
@@ -179,7 +180,7 @@
179180
if (typeof oldValue === 'undefined' || value === oldValue)
180181
return;
181182
value = value ? value.toString() : '';
182-
let start = this.$.input.selectionStart;
183+
let start = this.$.input.inputElement.selectionStart;
183184
let initialSlashesBeforeCaret = value.substr(0, start).split('/').length - 1;
184185
value = value.replace(/\//g, '');
185186
let shouldFormat = value.length <= this.datePattern.replace(/\//g, '').length;
@@ -198,7 +199,7 @@
198199
let updatedSlashesBeforeCaret = formattedValue.substr(0, start).split('/').length - 1;
199200
let slashesDifference = updatedSlashesBeforeCaret - initialSlashesBeforeCaret;
200201
this.updateValueAndPreserveCaret(formattedValue.trim());
201-
this.$.input.selectionStart = this.$.input.selectionEnd = start + slashesDifference;
202+
this.$.input.inputElement.selectionStart = this.$.input.inputElement.selectionEnd = start + slashesDifference;
202203
this._handleAutoValidate();
203204
},
204205

0 commit comments

Comments
 (0)