Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/yup/es/ drwxr-xr-x | |
| Viewing file: Select action/file-type: // @ts-ignore
import isoParse from './util/isodate';
import { date as locale } from './locale';
import isAbsent from './util/isAbsent';
import Ref from './Reference';
import BaseSchema from './schema';
let invalidDate = new Date('');
let isDate = obj => Object.prototype.toString.call(obj) === '[object Date]';
export function create() {
return new DateSchema();
}
export default class DateSchema extends BaseSchema {
constructor() {
super({
type: 'date'
});
this.withMutation(() => {
this.transform(function (value) {
if (this.isType(value)) return value;
value = isoParse(value); // 0 is a valid timestamp equivalent to 1970-01-01T00:00:00Z(unix epoch) or before.
return !isNaN(value) ? new Date(value) : invalidDate;
});
});
}
_typeCheck(v) {
return isDate(v) && !isNaN(v.getTime());
}
prepareParam(ref, name) {
let param;
if (!Ref.isRef(ref)) {
let cast = this.cast(ref);
if (!this._typeCheck(cast)) throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
param = cast;
} else {
param = ref;
}
return param;
}
min(min, message = locale.min) {
let limit = this.prepareParam(min, 'min');
return this.test({
message,
name: 'min',
exclusive: true,
params: {
min
},
test(value) {
return isAbsent(value) || value >= this.resolve(limit);
}
});
}
max(max, message = locale.max) {
var limit = this.prepareParam(max, 'max');
return this.test({
message,
name: 'max',
exclusive: true,
params: {
max
},
test(value) {
return isAbsent(value) || value <= this.resolve(limit);
}
});
}
}
DateSchema.INVALID_DATE = invalidDate;
create.prototype = DateSchema.prototype;
create.INVALID_DATE = invalidDate; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0498 ]-- |