Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.
/ carbon Public archive

๐Ÿ“† Craft plugin that provides access to Carbon in Craft templates.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.md
Notifications You must be signed in to change notification settings

craftplugins/carbon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Important

This plugin is no longer maintained.

Carbon for Craft CMS

This plugin provides access to Carbon dates in Craft templates.

Screenshot

Usage

This plugin simply converts a date or string into a Carbon instance.

See the Carbon docs for all the methods available.

Converting

This plugin provides a function, a filter, and a variable for converting dates into Carbon instances.

{# As a function #}
{% set date = carbon(entry.postDate) %}
{% set date = carbon('3 days ago') %}

{# As a filter #}
{% set date = entry.postDate|carbon %}
{% set date = 'Last Friday'|carbon %}

{# As a variable #}
{% set date = craft.carbon.carbon(entry.postDate) %}
{% set date = craft.carbon.carbon('Saturday 5pm') %}

Examples

{# Getters #}
{{ date.dayName }}{# Saturday #}
{{ date.locale('de').dayName }}{# Samstag #}

{# Addition #}
{{ date.addDay() }}
{{ date.addSeconds(555) }}

{# Subtraction #}
{{ date.sub('2 days') }}
{{ date.subWeek() }}

{# Difference for humans #}
{{ carbon(entry.postDate).ago() }}{# 5 days ago #}
{{ carbon(entry.postDate).locale('ja_JP').ago() }}{# 5ๆ—ฅๅ‰ #}
{{ carbon('2020-01-01').diffForHumans('2020-02-02') }}{# 1 month before #} 

About

๐Ÿ“† Craft plugin that provides access to Carbon in Craft templates.

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages