This commit is contained in:
Dobie Wollert
2015-12-16 09:12:35 -08:00
parent f9c9672818
commit f94ca33b9e
805 changed files with 67409 additions and 24609 deletions

25
config/validators.js Normal file
View File

@ -0,0 +1,25 @@
'use strict';
var moment = require('moment');
var expressValidator = require('express-validator');
module.exports = function() {
return expressValidator({
customValidators: {
isWeek
},
customSanitizers: {
toMoment
}
});
};
function isWeek(str) {
let week = moment(str, 'YYYY-MM-DD');
return week.isValid() && week.weekday() === 0;
}
function toMoment(str) {
return moment(str);
}