PHPackages                             daun/datetime-carbon-format - 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. daun/datetime-carbon-format

ActiveProcesswire-module[Utility &amp; Helpers](/categories/utility)

daun/datetime-carbon-format
===========================

Format Datetime fields as Carbon instances

v2.0.6(3mo ago)1487MITPHPPHP ^8.1

Since Oct 20Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/daun/processwire-datetime-carbon-format)[ Packagist](https://packagist.org/packages/daun/datetime-carbon-format)[ Docs](https://github.com/daun/processwire-datetime-carbon-format)[ RSS](/packages/daun-datetime-carbon-format/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (17)Used By (0)

ProcessWire Datetime Carbon Format
==================================

[](#processwire-datetime-carbon-format)

[![GitHub tag (latest by date)](https://camo.githubusercontent.com/3aa21d57544a558cbd5ffa59a0dfef43e9f410862d3e5a7355f93a7e1dea615d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6461756e2f70726f63657373776972652d6461746574696d652d636172626f6e2d666f726d61743f636f6c6f723d393761616234266c6162656c3d76657273696f6e)](https://github.com/daun/processwire-datetime-carbon-format/releases)[![GitHub License](https://camo.githubusercontent.com/79f32d3a9bd7a29dee85e74f81337d84beba05b12d5ec0b9e186d41a2d55169d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6461756e2f70726f63657373776972652d6461746574696d652d636172626f6e2d666f726d61743f636f6c6f723d393761616234)](./LICENSE)

Format Datetime fields as [Carbon](https://carbon.nesbot.com/) instances.

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

[](#installation)

Install the module using Composer. This will install Carbon as a child dependency.

```
composer require daun/datetime-carbon-format
```

> ℹ️ Installation via the module directory will only work if you already have `nesbot/carbon` required from the project root.

Usage
-----

[](#usage)

All Datetime fields will now be formatted as Carbon instances instead of strings. Some examples of how to make use of this:

```
// $page->date is a Datetime field
// Output format: j/n/Y

echo $page->date;                    // 20/10/2027
echo $page->date->add('7 days');     // 27/10/2027
echo $page->date->format('l, F j');  // Monday, October 20
echo $page->date->year;              // 2027
echo $page->date->diffForHumans();   // 28 minutes ago
```

Consult the [Carbon docs](https://carbon.nesbot.com/docs/) for details.

Notes
-----

[](#notes)

### Frontend only

[](#frontend-only)

The ProcessWire admin expects datetime fields to be strings. That's why this module will only return Carbon instances on normal frontend page views.

### Date output format

[](#date-output-format)

When casting a Carbon instance to a string (usually when outputting the field in a template), the field's date output format will be respected.

### Empty values

[](#empty-values)

Empty date fields will be wrapped in a proxy object that silently "swallows" access to properties and methods without triggering an exception. That's because Carbon instances cannot be empty, i.e. created without a valid timestamp value.

Use either the `timestamp` property or the `isset` accessor to see if a date has a value.

```
// Date field with data
$page->date->timestamp;    // 1778870000
$page->date->isset;        // true
$page->date->year;         // 2027
$page->date->format('j');  // 20

// Empty date field
$page->date->timestamp;    // null
$page->date->isset;        // null
$page->date->year;         // null
$page->date->format('j');  // null
```

### `carbon` API Variable

[](#carbon-api-variable)

The module will create a pre-configured Carbon Factory and wire it into a new `carbon` API variable. This factory object can be used to create new Carbon instances, edit settings on it, etc.

```
// Create a new Carbon instance
$datetime = wire()->carbon->createFromTimestamp($timestamp);
```

Contributing
------------

[](#contributing)

Pull requests are welcome. Please read the [Contributing Guidelines](./CONTRIBUTING.md).

License
-------

[](#license)

[MIT](./LICENSE)

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance82

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity71

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 ~153 days

Recently: every ~81 days

Total

14

Last Release

90d ago

Major Versions

v1.x-dev → v2.0.02025-05-14

PHP version history (2 changes)v1.0.0PHP &gt;=7.0

v2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/31ac2b3787ded290b6bac87b937abf4f267483e4da64731bfb256a942bb669ca?d=identicon)[daun](/maintainers/daun)

---

Top Contributors

[![daun](https://avatars.githubusercontent.com/u/22225348?v=4)](https://github.com/daun "daun (30 commits)")

---

Tags

carbondatetimeprocesswireprocesswire-modulesprocesswiredatetimecarbonmodule

###  Code Quality

Static AnalysisRector

### Embed Badge

![Health badge](/badges/daun-datetime-carbon-format/health.svg)

```
[![Health](https://phpackages.com/badges/daun-datetime-carbon-format/health.svg)](https://phpackages.com/packages/daun-datetime-carbon-format)
```

###  Alternatives

[illuminate/support

The Illuminate Support package.

630113.0M41.3k](/packages/illuminate-support)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k18](/packages/solspace-craft-freeform)[mediawiki/maps

Adds various mapping features to MediaWiki

84152.3k3](/packages/mediawiki-maps)[civicrm/civicrm-drupal-8

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

19251.4k3](/packages/civicrm-civicrm-drupal-8)[altis/core

Core module for Altis

19228.0k3](/packages/altis-core)

PHPackages © 2026

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