PHPackages                             by-strange/datetime-picker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. by-strange/datetime-picker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

by-strange/datetime-picker
==========================

Date and time picker for Yii Framework.

0.1.6(1y ago)112mitPHPPHP &gt;=8.1

Since Feb 28Pushed 1y agoCompare

[ Source](https://github.com/byStrange/datetime-pick)[ Packagist](https://packagist.org/packages/by-strange/datetime-picker)[ RSS](/packages/by-strange-datetime-picker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (10)Versions (14)Used By (0)

 [ ![](https://camo.githubusercontent.com/cc75562bca6e54e98046e4fb187ef8d96c997a8f31c6f4d2f6ed0c816413b47a/68747470733a2f2f7777772e7969696672616d65776f726b2e636f6d2f696d6167652f7969695f6c6f676f5f6c696768742e737667) ](https://github.com/yii2-extensions/datetime-picker)

Tempus Dominus Date/Time Picker.
================================

[](#tempus-dominus-datetime-picker)

 [ ![php-version](https://camo.githubusercontent.com/cfe9179013aaeb962182231f5cc56946d96d3c7356e64008b58bad1025cfb1e9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e312d373837434235) ](https://www.php.net/releases/8.1/en.php) [ ![PHPUnit](https://github.com/yii2-extensions/datetime-picker/actions/workflows/build.yml/badge.svg) ](https://github.com/yii2-extensions/datetime-picker/actions/workflows/build.yml) [ ![PHPUnit](https://github.com/yii2-extensions/datetime-picker/actions/workflows/compatibility.yml/badge.svg) ](https://github.com/yii2-extensions/datetime-picker/actions/workflows/compatibility.yml) [ ![Codecov](https://camo.githubusercontent.com/4ed484ca8dcdf88eab80b7db042afb5b5e434dbabbfa6996e9d25beaae7283ee/68747470733a2f2f636f6465636f762e696f2f67682f796969322d657874656e73696f6e732f6461746574696d652d7069636b65722f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4d4630585547564c5943) ](https://codecov.io/gh/yii2-extensions/datetime-picker) [ ![Infection](https://camo.githubusercontent.com/bd541287765f654765a616e4a5a20b23d599457c358810efb9136d15ebbd6e6d/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246796969322d657874656e73696f6e732532466461746574696d652d7069636b65722532466d61696e) ](https://dashboard.stryker-mutator.io/reports/github.com/yii2-extensions/datetime-picker/main)

 [ ![](docs/images/datetime-picker.png) ](https://github.com/yii2-extensions/datetime-picker)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

Either run

```
composer require --dev --prefer-dist yii2-extensions/datetime-picker:^0.1
```

or add

```
"yii2-extensions/datetime-picker": "^0.1"
```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

### Name

[](#name)

```
use Yii2\Extensions\DateTimePicker\DateTimePicker;

echo DateTimePicker::widget(['name' => 'datetime-picker']);
```

### Active Field

[](#active-field)

```
use Yii2\Extensions\DateTimePicker\DateTimePicker;

echo $form
    ->field($formModel, 'date')
    ->widget(
        DateTimePicker::class,
        [
            'icon' => Icon::renderIcon('solid', 'calendar', ['class' => 'me-2 fa-solid'])
        ]
    );
```

### Active Field Floating Label

[](#active-field-floating-label)

```
use Yii2\Extensions\DateTimePicker\DateTimePicker;

echo $form
    ->field($formModel, 'date', ['options' => ['class' => 'mt-3']])
    ->label(false)
    ->widget(
        DateTimePicker::class,
        [
            'floatingLabel' => true,
            'icon' => Icon::renderIcon('solid', 'calendar', ['class' => 'me-2 fa-solid'])
        ]
    )
```

### Dynamic Theme Configuration for tempusDominus Widget Library

[](#dynamic-theme-configuration-for-tempusdominus-widget-library)

This library provides functionality to dynamically configure the tempusDominus widget's theme based on user preferences or predefined settings.

#### Functionality Overview

[](#functionality-overview)

The library introduces a feature to automatically set up the tempusDominus widget with a theme determined by the user's preference or specified configurations.

##### Automatic Theme Configuration

[](#automatic-theme-configuration)

Upon initialization, the library checks for theme configuration settings. If the user has specified a theme in the library's configuration, it takes precedence.

##### Browser-Based Theme Detection

[](#browser-based-theme-detection)

If no specific theme is set or the attribute data-bs-theme is absent: The library uses the prefers-color-scheme media query to detect the user's system preference for `light` or `dark` mode.

##### Applying Theme Configuration to tempusDominus Widget

[](#applying-theme-configuration-to-tempusdominus-widget)

The library sets the theme configuration `(theme: 'dark' or theme: 'light')` based on the detected or specified theme. This configuration is then applied to the tempusDominus widget using the library's internal functionalities.

### Properties of the widget

[](#properties-of-the-widget)

PropertyTypeDescriptionDefault`config``array`The configuration of the widget.`[]``containerClass``string`The class of the container.`input-group``cdn``boolean`Whether to use the CDN.`true``floatingLabel``boolean`Whether to use the floating label.`false``format``string`The format of the date.`yyyy/MM/dd HH:mm:ss``formatMonth``string`The format of the month.`long``formatYear``string`The format of the year.`numeric``icon``string`The icon of the widget.`''``id``string`The ID of the widget.`datetimepicker1``labelClass``string`The class of the label.`form-label``labelContent``string`The content of the label.`''``spanClass``string`The class of the span.`input-group-text``startOfTheWeek``integer`The start of the week.`1``template``string`The template of the widget. `'{label}\n{input}\n{span}'`### Translation support

[](#translation-support)

The extension supports translation. You can translate the extension into your language, for default the extension supports the following languages.

- Chinese
- English
- French
- German
- Portuguese
- Russian
- Spanish

Quality code
------------

[](#quality-code)

[![static-analysis](https://github.com/yii2-extensions/datetime-picker/actions/workflows/static.yml/badge.svg)](https://github.com/yii2-extensions/datetime-picker/actions/workflows/static.yml)[![phpstan-level](https://camo.githubusercontent.com/5cb322768cf6be272de6246267f22cbd24eb4ed00e1953844bd8901e53191fe3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2532306c6576656c2d372d626c7565)](https://github.com/yii2-extensions/datetime-picker/actions/workflows/static.yml)[![StyleCI](https://camo.githubusercontent.com/b710c46a573677604a985485658dbb059009af5331c02f2cd5d9eee0a9a41d83/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3732323438373137352f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/722487175?branch=main)

Support versions Yii2
---------------------

[](#support-versions-yii2)

[![Yii20](https://camo.githubusercontent.com/eb75eedd3cbc9159c862871d7ba5a079f2d8843e186c4365f72e55b402076f4b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5969693225323076657273696f6e2d322e302d626c7565)](https://github.com/yiisoft/yii2/tree/2.0.49.3)[![Yii22](https://camo.githubusercontent.com/f946cb5d9010fb3cc3f9d9530b51fee224bdbabe1345dd3f090dfbca82446217/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5969693225323076657273696f6e2d322e322d626c7565)](https://github.com/yiisoft/yii2/tree/2.2)

Testing
-------

[](#testing)

[Check the documentation testing](docs/testing.md) to learn about testing.

Our social networks
-------------------

[](#our-social-networks)

[![Twitter](https://camo.githubusercontent.com/d077c362ac639792171af8bc002ee827816733dfc0925f70b557e6d151022226/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f747769747465722d666f6c6c6f772d3144413146323f6c6f676f3d74776974746572266c6f676f436f6c6f723d314441314632266c6162656c436f6c6f723d3535353535353f7374796c653d666c6174)](https://twitter.com/Terabytesoftw)

License
-------

[](#license)

The MIT License. Please see [License File](LICENSE) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~33 days

Recently: every ~1 days

Total

7

Last Release

603d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d2e67a95a17d5219ffe27f55951d159b9acf9b0a7756e72b86665652ad5f50a?d=identicon)[byStrange](/maintainers/byStrange)

---

Top Contributors

[![byStrange](https://avatars.githubusercontent.com/u/80538114?v=4)](https://github.com/byStrange "byStrange (14 commits)")[![terabytesoftw](https://avatars.githubusercontent.com/u/42547589?v=4)](https://github.com/terabytesoftw "terabytesoftw (13 commits)")

---

Tags

componentdatetimepickerextensionpackagistphpyii2timedateyii2picker

###  Code Quality

TestsPHPUnit

Code StyleECS

### Embed Badge

![Health badge](/badges/by-strange-datetime-picker/health.svg)

```
[![Health](https://phpackages.com/badges/by-strange-datetime-picker/health.svg)](https://phpackages.com/packages/by-strange-datetime-picker)
```

###  Alternatives

[kartik-v/yii2-widget-datepicker

Enhanced Yii2 wrapper for the bootstrap datepicker plugin (sub repo split from yii2-widgets).

1097.0M59](/packages/kartik-v-yii2-widget-datepicker)[kartik-v/yii2-date-range

An advanced Yii 2 date range picker input for based on bootstrap-daterangepicker plugin.

894.4M41](/packages/kartik-v-yii2-date-range)[kartik-v/yii2-widget-timepicker

Enhanced Yii2 wrapper for the bootstrap timepicker plugin (sub repo split from yii2-widgets)

404.9M14](/packages/kartik-v-yii2-widget-timepicker)[aneeshikmat/yii2-time-down-counter

Widget for yii2, to start count down timer with a lot of options, This widget build dependence of timeDownCounter JS library

1546.0k](/packages/aneeshikmat-yii2-time-down-counter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
