Coder Social home page Coder Social logo

datetimecontrol's Introduction

Nette DateTime Form Control

including week number choice

Installation

  • link jQuery into your page
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  • link jQuery UI:
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
<script src="{$basePath}/js/jquery-ui-timepicker-addon.js"></script>
<script src="{$basePath}/js/datetimepicker.js"></script>
  • If you want to localize the calendar, download or create similar localization file as here.

  • add method into your app, e.g. in BasePresenter::startup():

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:
$form->addDateTime('from')
	->setDefaultValue(new \Nette\DateTime('- 1 day'))
	->setTimeFormat(NULL);
  • and customize:
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)';

datetimecontrol's People

Contributors

vladahejda avatar

Watchers

James Cloos avatar  avatar

datetimecontrol's Issues

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.