• This repository has been archived on 27/Jul/2023
  • Stars
    star
    130
  • Rank 276,754 (Top 6 %)
  • Language
    PHP
  • License
    Other
  • Created over 10 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bootstrap DatePicker Widget for Yii2

Bootstrap DatePicker Widget for Yii2

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Renders a Bootstrap DatePicker plugin.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require 2amigos/yii2-date-picker-widget:~1.0

or add

"2amigos/yii2-date-picker-widget" : "~1.0"

to the require section of your application's composer.json file.

Usage

The widget comes in two flavors:

  • DatePicker
  • DateRangePicker

DatePicker

This widget renders a Bootstrap DatePicker input control. Best suitable for model with date string attribute.

Example of use with a form
There are two ways of using it, with an ActiveForm instance or as a widget setting up its model and attribute.

<?php
use dosamigos\datepicker\DatePicker;

// as a widget
?>

<?= DatePicker::widget([
    'model' => $model,
    'attribute' => 'date',
    'template' => '{addon}{input}',
        'clientOptions' => [
            'autoclose' => true,
            'format' => 'dd-M-yyyy'
        ]
]);?>

<?php 
// with an ActiveForm instance 
?>
<?= $form->field($model, 'date')->widget(
    DatePicker::className(), [
        // inline too, not bad
         'inline' => true, 
         // modify template for custom rendering
        'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>',
        'clientOptions' => [
            'autoclose' => true,
            'format' => 'dd-M-yyyy'
        ]
]);?>

Example of use without a model

<?php
use dosamigos\datepicker\DatePicker;
?>
<?= DatePicker::widget([
    'name' => 'Test',
    'value' => '02-16-2012',
    'template' => '{addon}{input}',
        'clientOptions' => [
            'autoclose' => true,
            'format' => 'dd-M-yyyy'
        ]
]);?>

DateRangePicker

This widget renders a Bootstrap DateRangePicker Input control.

Example of use with a form
The following example works with a model that has two attributes named date_from and date_to.

<?php
use dosamigos\datepicker\DateRangePicker;
?>
<?= $form->field($tour, 'date_from')->widget(DateRangePicker::className(), [
    'attributeTo' => 'date_to', 
    'form' => $form, // best for correct client validation
    'language' => 'es',
    'size' => 'lg',
    'clientOptions' => [
        'autoclose' => true,
        'format' => 'dd-M-yyyy'
    ]
]);?>

Example of use without a model

<?php
use dosamigos\datepicker\DateRangePicker;
?>
<?= DateRangePicker::widget([
    'name' => 'date_from',
    'value' => '02-16-2012',
    'nameTo' => 'name_to',
    'valueTo' => '02-20-2012'
]);?>

Testing

To test the extension, is better to clone this repository on your computer. After, go to the extensions folder and do the following (assuming you have composer installed on your computer):

$ composer install --no-interaction --prefer-source --dev

Once all required libraries are installed then do:

$ vendor/bin/phpunit

I would recommend to have phpunit globally installed together with xdebug so you can have code coverage analysis too.

Further Information

Please, check the Bootstrap DatePicker site documentation for further information about its configuration options.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The BSD License (BSD). Please see License File for more information.

2amigOS!
Web development has never been so fun!
www.2amigos.us

More Repositories

1

yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension
PHP
292
star
2

yii2-file-upload-widget

BlueImp File Upload Widget for Yii2
PHP
252
star
3

qrcode-library

Create QrCodes with ease
PHP
222
star
4

yii2-ckeditor-widget

CKEditor WYSIWYG widget for Yii2.
PHP
171
star
5

yiiwheels

Widget extension library for the YiiStrap extension
JavaScript
133
star
6

yii2-chartjs-widget

ChartJs Widget For Yii2
PHP
108
star
7

yii2-google-maps-library

Google Maps API library for Yii2
PHP
106
star
8

yii2-tinymce-widget

TinyMCE WYSIWYG widget for Yii2
JavaScript
100
star
9

yii2-taggable-behavior

This extension allows you to get functional for tagging.
PHP
85
star
10

yii2-selectize-widget

Selectize From Brian Reavis Yii2 Widget
PHP
73
star
11

yii2-translateable-behavior

Handles ActiveRecord's attribute translations
PHP
66
star
12

yii2-gallery-widget

BlueImp Gallery Widget for Yii2
PHP
60
star
13

yii2-editable-widget

X-Editable Widget for Yii2
PHP
58
star
14

yii2-grid-view-library

Highly enhanced GridView widget and grid components for Yii2
PHP
57
star
15

yii2-app-template

Yii 2 Basic Application Template with ConfigKit.
PHP
54
star
16

mailer-library

Mailer library with queue capabilities.
PHP
50
star
17

yii2-multi-select-widget

Bootstrap MultiSelect and MultiSelect Listbox widgets for Yii2
PHP
45
star
18

yiinitializr

Library that will help boost your application installation with ease and also to run Yii applications from its bootstrap files on a much cleaner way that the framework currently proposes.
PHP
44
star
19

yii2-date-time-picker-widget

Bootstrap DateTimePicker Widget for Yii2
PHP
44
star
20

yii2-highcharts-widget

HighCharts Js Widget for Yii2
PHP
42
star
21

yiiwheels-docs

Demo site for yii-wheels
PHP
40
star
22

yii2-resource-manager-component

Uploaded file management extension
PHP
35
star
23

2fa-library

2 Factor Authentication (2FA) library
PHP
34
star
24

yii2-leaflet-extension

Yii 2 Extension library to display interactive maps with Leaflet .
PHP
30
star
25

embeddable-js-widget-template

How to create an embeddable JS widget
JavaScript
27
star
26

yii2-transliterator-helper

TransliteratorHelper transliterates UTF-8 encoded text to US-ASCII
PHP
26
star
27

yii2-semantic-ui

Yii2 Semantic UI Extension
PHP
25
star
28

yii2-disqus-widget

DISQUS widget for Yii2
PHP
25
star
29

yii2-config-kit

Configuration kit for Yii applications
PHP
24
star
30

ei18n

Ei18 is a translation module to allow Yii'ers to easily manage missing translations on application pages. It is heavily inspired by yii.translate developed by Gustavo Salomรฉ Silva.
JavaScript
24
star
31

yii2-type-ahead-widget

Twitter Typeahead Bootstrap Widget
PHP
23
star
32

yii2-file-input-widget

Jasny File Input Bootstrap Widget
PHP
23
star
33

mail-api-service

A microservice to send emails based on templates.
PHP
23
star
34

yii2-google-places-library

Google Places API library for Yii2
PHP
23
star
35

yiifoundation

Yii extension library for the ZURB Foundation Framework
CSS
22
star
36

yii2-flysystem-component

The League Flysystem Library for Yii Framework
PHP
22
star
37

yiiaws

Amazon Web Services SDK PHP 2 Wrapper
PHP
21
star
38

yii2-arrayquery-component

ArrayQuery allows you to apply conditions to arrays that are to be displayed with ArrayDataProviders
PHP
21
star
39

yii2-exportable-widget

Allows the exportation of a GridView widget to different formats
PHP
20
star
40

yii2-switch-widget

Bootstrap Switch Widget for Yii2
PHP
17
star
41

egmap

Objet-oriented PHP abstraction to the Google Maps API to ease the process of adding a Google Map on your Yii projects.
PHP
14
star
42

efeed

Feed Writer Generator Extension (RSS 1.0, RSS 2.0, and ATOM 1.0)
PHP
12
star
43

yii-cdn-asset-management-library

CDN Asset Management Tools for Yii1
PHP
12
star
44

yii2-croppie-widget

Image cropping plugin for Yii2
PHP
11
star
45

yii2-dynamic-form

JavaScript
10
star
46

escriptboost

Minify the javascript/css code of your application's assets and pages
PHP
9
star
47

storage-api-service

A microservice that abstracts asset storage on different providers
PHP
9
star
48

google-places-library

Google Places API library
PHP
9
star
49

egeoip

EGeoIp Extension uses geoPlugin free webservice to locate IP geo information
PHP
9
star
50

yii2-bootstrap-form-helpers-library

Bootstrap Form Helpers Library Widgets for Yii2.
JavaScript
9
star
51

yii2-extension-skeleton

A skeleton repository for Yii2 Skeleton Packages
PHP
8
star
52

yii2-switchery-widget

Yii2 wrapper for iOS 7 style switches for your checkboxes
PHP
7
star
53

yii2-app-usuario-template

Yii 2 Basic Application Template with ConfigKit and Yii 2 Usuario Module
PHP
7
star
54

yii2-select2-widget

Select 2 jQuery plugin for Yii2 with Bootstrap theme capabilities
PHP
7
star
55

yiiwheels-custom

Yiiwheels custom library. Removes Yiistrap dependency and implements Yii2 based bootstrap library to be used on Yii1.
JavaScript
6
star
56

yiihelpers

A library of useful Helper functions to give your apps an extra hand.
PHP
6
star
57

transliteration-helper

TransliteratorHelper transliterates UTF-8 encoded text to US-ASCII
PHP
5
star
58

yii2-twilio-component

A Yii2 Application Component to ease the use of Twilio's PHP SDK
PHP
5
star
59

resource-manager

Uploaded file management extension
PHP
5
star
60

yii2-pjax-filter-behavior

PjaxFilter is an action filter that filters HTTP requests to ensure pjax calls.
PHP
4
star
61

yii2-leaflet-geocoder-plugin

Yii 2 Plugin that adds geo search capabilities to your leaflet maps with dropdown list capabilities.
PHP
4
star
62

yii2-leaflet-markercluster-plugin

Yii 2 LeafLet Plugin to provide beautiful, sophisticated, high performance marker clustering solution with smooth animations and lots of great features.
JavaScript
4
star
63

yii2-shopping-cart-component

3
star
64

yii2-dosamigos-asset-bundle

Includes assets that are common to projects using dosamigos extensions.
JavaScript
3
star
65

laravel-mail-api

A microservice to send emails based on templates.
PHP
2
star
66

yii2-nexmo-library

Allows you to send SMS through Nexmo Service Provider.
PHP
2
star
67

yii2-packagist-component

Yii 2 Packagist API extension component
PHP
1
star
68

command-bus

Simple Command Bus
PHP
1
star
69

yii2-leaflet-geosearch-plugin

Yii 2 Plugin that adds geo search capabilities to your leaflet maps.
JavaScript
1
star
70

yii2-file-manager

1
star
71

yii2-leaflet-makimarker-plugin

Yii 2 LeafLet Plugin to create map icons using Maki Icons from MapBox.
PHP
1
star