Skip to content

Commit 95949c8

Browse files
Diegoassisrafael
authored andcommitted
feat(ui-date-mask): include timezone offset in matching regex
* refactor(ui-date-mask): regex should match timezone offset it should match 0000-00-00T00:00:00.000Z 0000-00-00T00:00:00.000+00:00 * docs: updated demo to include ui-date-mask
1 parent 9576b14 commit 95949c8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

demo/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ <h2>ui-br-car-plate-mask</h2>
155155
<input type="text" name="field25" ng-model="carPlate" ui-br-car-plate-mask><br>
156156
<span></span>Plate: <span ng-bind="carPlate"></span> - <span ng-bind="form.field25.$error | json"></span><br>
157157
<br>
158+
159+
<h2>ui-date-mask</h2>
160+
<input type="text" name="field26" ng-model="initializedDateMask" ui-date-mask><br>
161+
<span></span>Date: <span ng-bind="initializedDateMask"></span> - <span ng-bind="form.field26.$error | json"></span><br>
162+
<br>
158163
</form>
159164
</body>
160165
</html>

src/global/date/date.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var moment = require('moment');
44
var StringMask = require('string-mask');
55

66
function isISODateString(date) {
7-
return /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$/
7+
return /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}([-+][0-9]{2}:[0-9]{2}|Z)$/
88
.test(date.toString());
99
}
1010

0 commit comments

Comments
 (0)