fx-form-widget
Version:
30 lines (27 loc) • 751 B
JavaScript
import dayjs from 'dayjs';
/**
* 使时间选择器不能选择今天以前的日期(不包括今天)
* @param current
* @param type
* @param num
*/
export var disabledDate = function disabledDate(current, type, num) {
// Can not select days before today
var tempNum = 1;
if (num !== undefined) tempNum = num;
if (type === 'above') {
return current && current < dayjs().subtract(tempNum, 'days');
} else if (type === 'below') {
return current && current > dayjs().subtract(tempNum, 'days');
}
};
/**
* 判断值是否真的为空,不存在
*/
export var isNotNullValue = function isNotNullValue(value) {
if (value === '' || value === undefined || value === null) {
return false;
} else {
return true;
}
};