承接 nepstor/yii2-datetime-compare-validator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nepstor/yii2-datetime-compare-validator

最新稳定版本:2.0.3

Composer 安装命令:

composer require nepstor/yii2-datetime-compare-validator

包简介

Yii2 validator for compare datetime.

README 文档

README

Validator for yii2 allows you to compare dates.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require nepstor/yii2-datetime-compare-validator "^2.0"

or add

"nepstor/yii2-datetime-compare-validator": "^2.0"

to the require section of your composer.json file.

Using

public function rules()
{
    return [
        ['begin', nepstor\validators\DateTimeCompareValidator::className(), 'compareAttribute' => 'end', 'format' => 'Y-m-d', 'operator' => '>=']
    ];
}

Properties

This validator compares the specified input datetime with another one and make sure if their relationship is as specified by the operator property.

  • compareAttribute: the name of the attribute whose value should be compared with.
  • compareValue: a constant value that the input value should be compared with. When both of this property and compareAttribute are specified, this property will take precedence.
  • operator: the comparison operator. Defaults to =. The following operators are supported:
    • =: check if two values are equal. The comparison is done is non-strict mode.
    • !=: check if two values are NOT equal. The comparison is done is non-strict mode.
    • >: check if value being validated is greater than the value being compared with.
    • >=: check if value being validated is greater than or equal to the value being compared with.
    • <: check if value being validated is less than the value being compared with.
    • <=: check if value being validated is less than or equal to the value being compared with.
  • format: Date format to parse values with. Defaults to Y-m-d.
  • jsFormat: Date format to parse values with client side. Defaults to YYYY-MM-DD.

统计信息

  • 总下载量: 82.18k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 3
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-06-12