PHPackages                             sjaakp/yii2-dateline - 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. sjaakp/yii2-dateline

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

sjaakp/yii2-dateline
====================

Widget to handle dates

2.0.3(1y ago)36891[1 issues](https://github.com/sjaakp/yii2-dateline/issues)1MITPHP

Since Jul 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sjaakp/yii2-dateline)[ Packagist](https://packagist.org/packages/sjaakp/yii2-dateline)[ RSS](/packages/sjaakp-yii2-dateline/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (1)Versions (10)Used By (1)

Yii2 Dateline
=============

[](#yii2-dateline)

#### Widget for date-related data in Yii 2.0 PHP Framework.

[](#widget-for-date-related-data-in-yii-20-php-framework)

[![Latest Stable Version](https://camo.githubusercontent.com/02997cee16cc5a34594d28622c0184f385f5179e96c57ad3010aede25b7dd967/68747470733a2f2f706f7365722e707567782e6f72672f736a61616b702f796969322d646174656c696e652f762f737461626c65)](https://packagist.org/packages/sjaakp/yii2-dateline)[![Total Downloads](https://camo.githubusercontent.com/353ee658bc5d34644ffef9ef3327328597e40c5229b49bf50e91924c51104551/68747470733a2f2f706f7365722e707567782e6f72672f736a61616b702f796969322d646174656c696e652f646f776e6c6f616473)](https://packagist.org/packages/sjaakp/yii2-dateline)[![License](https://camo.githubusercontent.com/25e0a4085c3393977ea4c7bc0226e32ef9fad134cfed21cf6bfa0f2a8164afab/68747470733a2f2f706f7365722e707567782e6f72672f736a61616b702f796969322d646174656c696e652f6c6963656e7365)](https://packagist.org/packages/sjaakp/yii2-dateline)

Dateline widget renders my [JavaScript Dateline](https://github.com/sjaakp/dateline). The event data for the dateline are provided by a Yii DataProvider (any object implementing [yii\\data\\DataProviderInterface](http://www.yiiframework.com/doc-2.0/yii-data-dataproviderinterface.html)).

A demonstration of Dateline widget is [here](https://sjaakpriester.nl/software/dateline2).

See it in action at [Moordatlas.nl](https://moordatlas.nl/event/dateline) (Dutch). At *Weltliteratur* is a [nice example](https://vossanto.weltliteratur.net/timeline/) of the underlying JavaScript widget.

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

[](#installation)

Install **Dateline** with [Composer](https://getcomposer.org/). Either add the following to the require section of your `composer.json` file:

`"sjaakp/yii2-dateline": "*"`

Or run:

`composer require sjaakp/yii2-dateline "*"`

You can manually install **Dateline** by [downloading the source in ZIP-format](https://github.com/sjaakp/yii2-dateline/archive/master.zip).

Using Dateline
--------------

[](#using-dateline)

**Yii2-dateline** implements a widget of the class `Dateline`. It gets its data from an `ActiveDataProvider`, `ArrayDataProvider`, or other class derived from [`BaseDataProvider`](https://yiiframework.com/doc-2.0/yii-data-basedataprovider.html "Yii") Using it is not unlike using a [GridView](http://www.yiiframework.com/doc-2.0/yii-grid-gridview.html "Yii Framework"). For instance, in the Controller you might have something like:

```

```

An example of rendering a `Dateline` in the `View` is:

```
use sjaakp\dateline\Dateline;

/* ... */

```

#### options

[](#options)

Dateline has the following options:

- **dataProvider**: the DataProvider for Dateline. Must be set.
- **attributes**: used to 'translate' the model attributes to Dateline attributes. It is an array with key =&gt; value pairs of:
    - {dateline attribute name} =&gt; {model attribute name}.
    - {dateline attribute name} =&gt; `function($model)` returning {model attribute value}.
- **options**: array of options for the underlying Dateline jQuery widget. More information [here](https://github.com/sjaakp/dateline#cursor "GitHub").
- **htmlOptions** (optional): array of HTML options for the Dateline container. Use this if you want to explicitly set the ID.

Bands
-----

[](#bands)

**Dateline** consists of one or more Bands. They each display the Events in a different time resolution.

A Band is defined by the Dateline method `band()`.

```
public function band( $options )

```

#### options

[](#options-1)

`$options` is an array with the following keys:

- **size**: the part of Dateline occupied by this band, as a percentage or another CSS3 dimension,
- **layout**: the only sensible value is `'overview'`; all other values (including none) default to `'normal'`, which is the layout of the main band
- **scale**: the time unit that divides the horizontal scale of the Band. The value should be one of the following unit constants (yes, Dateline has an astonishing range!):
    - `Dateline::MILLISECOND`
    - `Dateline::SECOND`
    - `Dateline::MINUTE`
    - `Dateline::HOUR`
    - `Dateline::DAY`
    - `Dateline::WEEK`
    - `Dateline::MONTH`
    - `Dateline::YEAR`
    - `Dateline::DECADE`
    - `Dateline::CENTURY`
    - `Dateline::MILLENNIUM`
- **interval**: the width of one division on the horizontal scale in pixels
- **multiple** (optional): modifies the horizontal scale division to multiples of the unit

Events
------

[](#events)

*Note that we're not talking about PHP or JavaScript events here!*

**Dateline** displays Events. These are Models or ActiveRecords characterized by a moment in time.

The Dateline::attributes property holds the translation from Model attributes to Dateline attributes.

A few attributes are essential for **Dateline**. The Dateline names are:

- **start**: the point in time where the Event is situated
- **text**: the text (or HTML) displayed on the main Dateline

Events come in two types:

#### Instant Events

[](#instant-events)

These are the basic Events, having just one point in time. **Dateline** displays them as dot icons. Only the above attributes are required.

#### Duration Events

[](#duration-events)

These have a certain duration. **Dateline** displays them as a piece of 'tape'. Apart from the above, also required is:

- **stop**: the point in time where, well, the Event ends.

Duration Events also have some optional attributes, making the Event *imprecise*:

- **post\_start**: *optional*. Indicates a degree of uncertainty in `start`.
- **pre\_stop**: *optional*. Indicates a degree of uncertainty in `stop`.

The imprecise part of a Duration Event is displayed as faded tape.

#### Optional Event attribute

[](#optional-event-attribute)

- **class**: sets the HTML class(es) of the event in normal layout. Can be used to iconize or colorize an event. For more information, see [https://github.com/sjaakp/dateline#iconizing-events](https://github.com/sjaakp/dateline#iconizing-events "jQuery.dateline")

Dates
-----

[](#dates)

**Dateline** understands a lot of date formats (in the options and in the Event data). Every date can be provided in one of the following formats:

- a `string`, recognized by [JavaScript Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date), that is in RFC2822 or ISO-8601 format; among them MySQL `date` and `datetime` fields
- an `integer`: Unix time stamp (seconds since the Unix Epoch, 1-1-1970, return value of PHP `time()`)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance25

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~408 days

Recently: every ~605 days

Total

9

Last Release

688d ago

Major Versions

1.0.5 → 2.0.12019-08-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/156f636aceedc73021a2bfafb5433271c2c55d6cf4bce06b12902c85b4b491f1?d=identicon)[sjaakp](/maintainers/sjaakp)

---

Top Contributors

[![sjaakp](https://avatars.githubusercontent.com/u/5585878?v=4)](https://github.com/sjaakp "sjaakp (16 commits)")

---

Tags

datetimedateyii2extensionwidgetyiitimeline

### Embed Badge

![Health badge](/badges/sjaakp-yii2-dateline/health.svg)

```
[![Health](https://phpackages.com/badges/sjaakp-yii2-dateline/health.svg)](https://phpackages.com/packages/sjaakp-yii2-dateline)
```

###  Alternatives

[sjaakp/yii2-timeline

Simile Timeline widget for Yii2.

161.1k](/packages/sjaakp-yii2-timeline)

PHPackages © 2026

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