mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-14 14:28:31 +03:00
Delete validation for now; not relevant to this PR
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import R from 'ramda';
|
||||
import R from 'ramda'
|
||||
|
||||
/* eslint-disable */
|
||||
String.prototype.replaceAll = function (search, replacement) {
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
import moment from 'moment';
|
||||
|
||||
const DATE_FORMAT = "MM/DD/YYYY";
|
||||
const TIME_REGEX = "^([01]\d|2[0-3]):?([0-5]\d)$"
|
||||
|
||||
export const validateLongitude = value => {
|
||||
return isFinite(value) && Math.abs(value) <= 180;
|
||||
}
|
||||
|
||||
export const validateLatitude = value => {
|
||||
return isFinite(lat) && Math.abs(lat) <= 90;
|
||||
}
|
||||
|
||||
export const validateDate = date => {
|
||||
return moment(date, DATE_FORMAT, true).isValid();
|
||||
}
|
||||
|
||||
export const validateTime = time => {
|
||||
return TIME_REGEX.test(time);
|
||||
}
|
||||
|
||||
|
||||
export const getColumnValidator = colName => {
|
||||
switch(colName) {
|
||||
case 'longitue':
|
||||
return validateLongitude;
|
||||
case 'latitude':
|
||||
return validateLatitude;
|
||||
case 'date':
|
||||
return validateDate;
|
||||
case 'time':
|
||||
return validateTime;
|
||||
default: () => return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user