Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vladahejda/datetimecontrol
Nette DateTime Form Control
https://github.com/vladahejda/datetimecontrol
Last synced: about 1 month ago
JSON representation
Nette DateTime Form Control
- Host: GitHub
- URL: https://github.com/vladahejda/datetimecontrol
- Owner: VladaHejda
- Created: 2014-07-07T09:28:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-27T12:52:39.000Z (over 9 years ago)
- Last Synced: 2024-10-27T05:11:26.373Z (2 months ago)
- Language: PHP
- Size: 152 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Nette DateTime Form Control
===========================**including week number choice**
Installation
------------- link jQuery into your page
```html```
- link jQuery UI:
```html```
- Download and link [jQuery UI Datepicker](http://trentrichardson.com/examples/timepicker/)
```html```
- Download [DateTimeControl.php](https://raw.githubusercontent.com/VladaHejda/DateTimeControl/master/src/DateTimeControl.php), let it load by autoloading
- Download [datetimepicker.js](https://raw.githubusercontent.com/VladaHejda/DateTimeControl/master/src/datetimepicker.js) and link it
```html```
- If you want to localize the calendar, download or create similar localization file as [here](localization).
- add method into your app, e.g. in `BasePresenter::startup()`:
```php
use Nette\Forms;
use Nais\Components\DateTimeControl;Forms\Container::extensionMethod('addDateTime', function (Forms\Container $form, $name, $label = NULL, $cols = NULL, $invalidMessage = NULL) {
return $form[$name] = new DateTimeControl($label, $cols, $invalidMessage);
});
```- use it:
```php
$form->addDateTime('from')
->setDefaultValue(new \Nette\DateTime('- 1 day'))
->setTimeFormat(NULL);
```- and customize:
```php
use Nais\Components\DateTimeControl;DateTimeControl::$months = array('leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen',
'září', 'říjen', 'listopad', 'prosinec');
DateTimeControl::$monthsShort = array('led', 'úno', 'bře', 'dub', 'kvě', 'čer', 'čvc', 'srp', 'zář', 'říj',
'lis', 'pro');
DateTimeControl::$days = array('neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota');
DateTimeControl::$daysShort = array('ne', 'po', 'út', 'st', 'čt', 'pá', 'so');
DateTimeControl::$defaultDateFormat = 'dd. mm. yy';
DateTimeControl::$defaultTimeFormat = '(HH:mm)';
```