PHPackages                             cyberpunkcodes/laravel-moment-timezone - 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. cyberpunkcodes/laravel-moment-timezone

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

cyberpunkcodes/laravel-moment-timezone
======================================

Laravel package that shows dates/times in the users timezone using Moment

v1.0.2(1y ago)019MITPHPPHP ^8.0

Since Nov 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/CyberPunkCodes/laravel-moment-timezone)[ Packagist](https://packagist.org/packages/cyberpunkcodes/laravel-moment-timezone)[ Docs](https://github.com/CyberPunkCodes/laravel-moment-timezone)[ RSS](/packages/cyberpunkcodes-laravel-moment-timezone/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Laravel Moment Timezone
=======================

[](#laravel-moment-timezone)

Laravel package to convert dates/times to the user's local time using Moment and Moment Timezone.

A special thanks to [Blade UI Kit](https://github.com/blade-ui-kit/blade-ui-kit) for the base of this package. If you need UI components like inputs, buttons, alerts, be sure to check them out.

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

[](#installation)

Install using Composer:

```
composer require cyberpunkcodes/laravel-moment-timezone
```

Add the directive to your layout, right before the closing `` tag, after all other scripts have been loaded, to load the required JavaScript files:

```
@momentScripts
```

It is recommended to publish the config file so future updates to this package don't upgrade the Moment and Moment Timezone JavaScript files and surprise you in production. By publishing the config file, the asset versions won't update until you manually update them in the config.

Publish the config file by running:

```
php artisan vendor:publish --tag=moment-config
```

In `config/moment.php` you will see an `assets` array with a child `scripts` array. Each of the scripts in this array will be directly printed when called by the `@momentScripts` directive.

Include the full `` tag. This is so you can copy it from a source like CDNJS and keep the integrity hash checking.

Optionally, you can add the scripts to your asset bundling/minifying processors. In which case, you would not use the `@momentScripts` directive.

If you want to customize the component's view file, run:

```
php artisan vendor:publish --tag=moment-views
```

Usage
-----

[](#usage)

Replace all the dates/times in your view files with the moment component

```

```

That will display as: January 23rd, 2023 at 12:07 pm

The default usage uses PHP's datetime formatting. For more details, read the PHP docs here:

### Human Readable

[](#human-readable)

To display as human readable, which prints "2 minutes ago" or "2 months ago", you can simply add the `human` attribute like so:

```

```

### Local Timezone

[](#local-timezone)

Finally, if you want to show the dates/times in the user's local timezone, simply add the `local` attribute like so:

```

```

It is important to note that the format when using the `local` attribute must use the formatting rules from Moment and not PHP. See the Moment formatting rules for more info:

Here is a side-by-side comparison of both. They both result in displaying the exact same.

PHP Format: `F jS, Y \a\t g:i a`

Moment Format: `MMMM Do, Y [at] h:mm a`

Both will display as: `January 23rd, 2023 at 12:07 pm`

Prefix
------

[](#prefix)

If you have another component named `moment` and are experiencing a conflict, you can define a custom prefix.

If you set your prefix to `cool` then you would use the component like so:

```

```

After you rename a component, you may see errors about the component not being able to be found. This is due to view caching. You must clear the view cache:

```
php artisan view:clear
```

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

[](#contributing)

I intend on keeping this package simple. The use case is only for Moment and Moment Timezone. If you find an error/bug, or want to help clean up this readme, please create an issue first so we can discuss it before you waste time on a pull request.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Total

3

Last Release

704d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/70491f944b51bf6bc9ead87d1f4d5b0c2ff61535dd9587c1637c533f5bba5b06?d=identicon)[CyberPunkCodes](/maintainers/CyberPunkCodes)

---

Top Contributors

[![CyberPunkCodes](https://avatars.githubusercontent.com/u/9557392?v=4)](https://github.com/CyberPunkCodes "CyberPunkCodes (9 commits)")

---

Tags

laraveldatetimetimedatemomenttimezonestimezonemomentjs

### Embed Badge

![Health badge](/badges/cyberpunkcodes-laravel-moment-timezone/health.svg)

```
[![Health](https://phpackages.com/badges/cyberpunkcodes-laravel-moment-timezone/health.svg)](https://phpackages.com/packages/cyberpunkcodes-laravel-moment-timezone)
```

###  Alternatives

[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14282.3k](/packages/dater-dater)[fresh/datetime

PHP library that provides additional functions for processing dates &amp; times.

17513.8k2](/packages/fresh-datetime)[maherelgamil/arabicdatetime

Easy and useful tool to generate arabic or hijri date with multi-language support for laravel

414.5k](/packages/maherelgamil-arabicdatetime)[p3ym4n/jdate

Date converter from Jalali to Georgian and vice versa. It has Carbon instance inside and it's Laravel friendly.

101.8k2](/packages/p3ym4n-jdate)

PHPackages © 2026

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