Skip to content

Commit

Permalink
feat(ui-date-mask): include timezone offset in matching regex
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Diego authored and assisrafael committed Apr 5, 2016
1 parent 9576b14 commit 95949c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ <h2>ui-br-car-plate-mask</h2>
<input type="text" name="field25" ng-model="carPlate" ui-br-car-plate-mask><br>
<span></span>Plate: <span ng-bind="carPlate"></span> - <span ng-bind="form.field25.$error | json"></span><br>
<br>

<h2>ui-date-mask</h2>
<input type="text" name="field26" ng-model="initializedDateMask" ui-date-mask><br>
<span></span>Date: <span ng-bind="initializedDateMask"></span> - <span ng-bind="form.field26.$error | json"></span><br>
<br>
</form>
</body>
</html>
2 changes: 1 addition & 1 deletion src/global/date/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var moment = require('moment');
var StringMask = require('string-mask');

function isISODateString(date) {
return /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$/
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)$/
.test(date.toString());
}

Expand Down

0 comments on commit 95949c8

Please sign in to comment.