doufu2396 2018-10-31 09:15
浏览 93

startDate和endDate在yii2 kartik插件中的DateRangePicker小部件中不起作用

DateRangePicker::widget([
            'model' => $model,
            'attribute' => 'date_range',
            'startAttribute' => 'from_date',
            'endAttribute' => 'to_date',
            'convertFormat' => true,
            'presetDropdown' => true,
            'hideInput' => true,
            'value' => '',
            'pluginOptions' => [
                'locale' => ['format' => 'd M Y'],
                'endDate'=> date('d-m-Y'),
                'startDate'=> date('d-m-Y',strtotime('-6 months'))
            ]
        ]);

Above is code using which i am date range picker for filter but it is also making future date also selectable.But i want to disable them. I search the google and find the solution that if i put startDate and endDate in plugin option then it will not allow user to select future date. But unable to get the correct result.

Composer.json file code

{
    "name": "yiisoft/yii2-app-advanced",
    "description": "Yii 2 Advanced Project Template",
    "keywords": ["yii2", "framework", "advanced", "project template"],
    "homepage": "http://www.yiiframework.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/yiisoft/yii2/issues?state=open",
        "forum": "http://www.yiiframework.com/forum/",
        "wiki": "http://www.yiiframework.com/wiki/",
        "irc": "irc://irc.freenode.net/yii",
        "source": "https://github.com/yiisoft/yii2"
    },
    "minimum-stability": "stable",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": "2.0.13",
        "yiisoft/yii2-bootstrap": "~2.0.0",
        "yiisoft/yii2-swiftmailer": "~2.0.0",
        "kartik-v/yii2-widget-select2": "2.1.0",
        "kartik-v/yii2-widget-datetimepicker": "^1.4",
        "aws/aws-sdk-php": "3.36.9",
        "kartik-v/yii2-widget-growl": "v1.1.1",
        "kartik-v/yii2-detail-view": "@dev",
    "ckeditor/ckeditor": "dev-full/4.7.x as 4.7.0",
        "kartik-v/yii2-widget-sidenav": "v1.0.0",
        "dmstr/yii2-adminlte-asset": "2.4.4",
        "kartik-v/yii2-date-range": "1.6.8",
        "kartik-v/yii2-widget-fileinput": "1.0.5",
        "kartik-v/yii2-widget-activeform": "v1.4.8",
        "linslin/yii2-curl": "1.2.0",
        "kartik-v/yii2-widget-datepicker": "v1.4.3",       
        "vova07/yii2-imperavi-widget": "2.0.2",
        "yiidoc/yii2-redactor": "2.0.1",
        "phpmailer/phpmailer": "6.0.5",
        "yii2tech/csv-grid": "1.0.1",
        "predis/predis": "1.1.1",
        "miloschuman/yii2-highcharts-widget": "*"
    },
    "require-dev": {
        "yiisoft/yii2-debug": "~2.0.0",
        "yiisoft/yii2-gii": "~2.0.0",
        "yiisoft/yii2-faker": "~2.0.0",

        "codeception/base": "^2.2.3",
        "codeception/verify": "~0.3.1"
    },
    "config": {
        "process-timeout": 1800,
        "fxp-asset":{
            "installer-paths": {
                "npm-asset-library": "vendor/npm",
                "bower-asset-library": "vendor/bower"
            }
        }
    }
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 安装svn网络有问题怎么办
    • ¥15 Python爬取指定微博话题下的内容,保存为txt
    • ¥15 vue2登录调用后端接口如何实现
    • ¥65 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥15 latex怎么处理论文引理引用参考文献