Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/voda/dateinput
Form component for Nette Framework supporting all HTML 5 date inputs.
https://github.com/voda/dateinput
addon datepicker nette
Last synced: 24 days ago
JSON representation
Form component for Nette Framework supporting all HTML 5 date inputs.
- Host: GitHub
- URL: https://github.com/voda/dateinput
- Owner: voda
- License: other
- Created: 2011-05-13T20:39:06.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2024-08-04T11:34:34.000Z (3 months ago)
- Last Synced: 2024-10-12T15:21:11.644Z (24 days ago)
- Topics: addon, datepicker, nette
- Language: PHP
- Homepage: http://date-input.vodacek.eu/
- Size: 73.2 KB
- Stars: 10
- Watchers: 3
- Forks: 11
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- Changelog: changeNetteVersion.sh
- License: LICENSE
Awesome Lists containing this project
README
DateInput
=========
Nette forms component for selecting date and time values.In PHP this addon works with DateTime objects, in the browser it uses jqueryUI calendar with timepicker addon. Look at some examples at the [demo page](http://date-input.vodacek.eu/).
[![Build Status](https://travis-ci.org/voda/DateInput.svg?branch=master)](https://travis-ci.org/voda/DateInput)
[![Latest Stable Version](https://poser.pugx.org/voda/date-input/v/stable)](https://packagist.org/packages/voda/date-input)
[![Total Downloads](https://poser.pugx.org/voda/date-input/downloads)](https://packagist.org/packages/voda/date-input)
[![License](https://poser.pugx.org/voda/date-input/license)](https://packagist.org/packages/voda/date-input)JS dependencies
---------------
* [jQuery](http://jquery.com/) and [jQueryUI](http://jqueryui.com/)
* [Timepicker addon](http://trentrichardson.com/examples/timepicker/) version 1.1.0 or newerInstallation
------------`$ composer require voda/date-input`
package can be also installed using bower: `$ bower install voda-date-input --save`
insert required javascript and style files into your layout (order of scripts is important):
```html```
register the addon in your bootstrap.php:
```
Vodacek\Forms\Controls\DateInput::register();
```
initialize the calendar using javascript:
```js
$(document).ready(function() {
$('input[data-dateinput-type]').dateinput({
'datetime-local': {
dateFormat: 'd.m.yy',
timeFormat: 'H:mm',
options: { // options for type=datetime-local
changeYear: true
}
},
date: {
dateFormat: 'd.m.yy'
},
month: {
dateFormat: 'MM yy'
},
week: {
dateFormat: "w. 'week of' yy"
},
time: {
timeFormat: 'H:mm'
},
options: { // global options
closeText: "Close"
}
});
});
```Usage
-----
```php
$form->addDate('datetimeLocal', 'Local datetime', DateInput::TYPE_DATETIME_LOCAL)
->setRequired()
->setDefaultValue(new DateTimeImmutable())
->addRule(Form::RANGE, null, array(new DateTimeImmutable('-2 years'), new DateTimeImmutable('+2 years')));
```