Skip to main content

date_format

Function date_format 

Source
pub fn date_format(
    value: &Value,
    rule: &str,
    _data: &Value,
    _field: &str,
) -> bool
Expand description

验证时间和日期是否符合指定格式 — 对齐 PHP dateFormat

对齐 PHP Validate.php 第 1109-1113 行

§PHP 行为

$info = date_parse_from_format($rule, $value);
return 0 == $info['warning_count'] && 0 == $info['error_count'];