Skip to content

Commit

Permalink
Date validation (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivansg44 authored May 26, 2020
1 parent 927a28c commit e18eade
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions libraries/moment.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions main.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
<script type="text/javascript" src="libraries/shim.min.js"></script>
<script type="text/javascript" src="libraries/xlsx.full.min.js"></script>
<script type="text/javascript" src="libraries/chosen.jquery.min.js"></script>
<script type="text/javascript" src="libraries/moment.min.js"></script>
<script src="data.js"></script>
<script src="main.js"></script>
</body>
Expand Down
4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const getColumns = (data) => {
col.type = 'numeric';
} else if (field.datatype === 'date') {
col.type = 'date';
col.dateFormat = 'YYYY/MM/DD';
col.dateFormat = 'YYYY-MM-DD';
} else if (field.datatype === 'select') {
col.type = 'autocomplete';
col.source = field.flatVocabulary;
Expand Down Expand Up @@ -304,7 +304,7 @@ const getInvalidCells = (hot, data) => {
} else if (datatype === 'decimal') {
valid = !isNaN(cellVal);
} else if (datatype === 'date') {
// TODO
valid = moment(cellVal, 'YYYY-MM-DD').isValid();
} else if (datatype === 'select') {
valid = validateDropDown(cellVal, fields[col].flatVocabulary);
} else if (datatype === 'multiple') {
Expand Down

0 comments on commit e18eade

Please sign in to comment.