Giter Club home page Giter Club logo

yii2-date-range's Introduction

yii2-date-range

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads

An advanced date range picker input for Yii Framework 2 based on dangrossman/bootstrap-daterangepicker plugin. The date range picker widget is styled for Bootstrap 3.x and creates a dropdown menu from which a user can select a range of dates. If the plugin is invoked with no options, it will present two calendars to choose a start and end date from. Optionally, you can provide a list of date ranges the user can select from instead of choosing dates from the calendars. If attached to a text input, the selected dates will be inserted into the text box. Otherwise, you can provide a custom callback function to receive the selection.

Additional enhancements added for this widget (by Krajee):

  • allows ability to work with Bootstrap input group addons and set the picker position to point at the input-group-addon icon.
  • enhanced translation features using yii i18n message files.
  • automatically convert format from PHP Date/time format to Moment.js Date/time format.
  • automatically trigger change of base field to enforce Yii ActiveField validation
  • ability to set the widget to display a preset dropdown of date options within a container (and hidden input).
  • style the container options as per your need using templates
  • automatically disable date-range based on disabled/readonly options.

Demo

You can see detailed documentation on usage of the extension.

Latest Release

The latest version of the extension is release v1.6.6. Refer the CHANGE LOG for details of various releases.

Installation

The preferred way to install this extension is through composer.

Note: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

Either run

$ php composer.phar require kartik-v/yii2-date-range "dev-master"

or add

"kartik-v/yii2-date-range": "dev-master"

to the require section of your composer.json file.

Usage

DateRangePicker

use kartik\daterange\DateRangePicker;
echo DateRangePicker::widget([
    'model'=>$model,
    'attribute'=>'datetime_range',
    'convertFormat'=>true,
    'pluginOptions'=>[
        'timePicker'=>true,
        'timePickerIncrement'=>30,
        'locale'=>[
            'format'=>'Y-m-d h:i A'
        ]
    ]
]);

or using seperate min/max attributes on model

use kartik\daterange\DateRangePicker;
echo DateRangePicker::widget([
    'model'=>$model,
    'attribute'=>'datetime_range',
    'convertFormat'=>true,
    'startAttribute'=>'datetime_min',
    'endAttribute'=>'datetime_max',
    'pluginOptions'=>[
        'timePicker'=>true,
        'timePickerIncrement'=>30,
        'locale'=>[
            'format'=>'Y-m-d h:i A'
        ]
    ]
]);

License

yii2-date-range is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

yii2-date-range's People

Contributors

agrumas avatar andredp avatar dogrocker avatar edofre avatar ekawalec avatar fedemotta avatar githubjeka avatar gitnchez avatar kartik-v avatar kksudo avatar leandrogehlen avatar madand avatar mikk150 avatar pc-brainy avatar samkoch avatar tibee avatar torvaldz avatar tranch avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.