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: about 1 year 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 (about 15 years ago)
- Default Branch: master
- Last Pushed: 2024-08-04T11:34:34.000Z (almost 2 years ago)
- Last Synced: 2025-04-20T14:58:39.126Z (about 1 year ago)
- Topics: addon, datepicker, nette
- Language: PHP
- Homepage: http://date-input.vodacek.eu/
- Size: 73.2 KB
- Stars: 10
- Watchers: 2
- 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/).
[](https://travis-ci.org/voda/DateInput)
[](https://packagist.org/packages/voda/date-input)
[](https://packagist.org/packages/voda/date-input)
[](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 newer
Installation
------------
`$ 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')));
```