Laravel EnsoLaravel Enso
Guide
Back End
Front End
GitHub
Guide
Back End
Front End
GitHub
  • Front End

    • Accessories
    • Addresses
    • Algolia
    • Audits
    • Auth
    • Bookmarks
    • Calendar
    • Card
    • Cargo Partner
    • Categories
    • Charts
    • Checkbox
    • Clipboard
    • Comments
    • Commercial
    • Companies
    • Confirmation
    • Currencies
    • Data Import
    • Date
    • Datepicker
    • Directives
    • Discounts
    • Divider
    • Documents
    • Dropdown
    • Dropdown Indicator
    • Eav
    • Emag
    • Emails
    • Enums
    • ERD
    • Facebook
    • Files
    • Filters
    • Financials
    • Forms
    • Frisbo
    • Google
    • Holidays
    • How to
    • Interactions
    • Inventory
    • IO
    • Laravel Validation
    • Loader
    • Localisation
    • Logs
    • Measurement Units
    • Meili Search
    • Menus
    • Mixins
    • Modal
    • Money
    • Monitored Emails
    • Notifications
    • Orderable Trees
    • Packaging Units
    • Pagination
    • People
    • Permissions
    • Product Lots
    • Products
    • Progress Bar
    • Progress Circle
    • Progress Indicator
    • Questionnaires
    • Quick View
    • Range Slider
    • Rating
    • Roles
    • Route Mapper
    • Sale Channels
    • Scroll to Top
    • Search Mode
    • Select
    • Sentry
    • Services
    • Smart Bill
    • SMS Advert
    • Strings
    • Switch
    • Tables
    • Tabs
    • Tasks
    • Teams
    • Textarea
    • Themes
    • Ticketing
    • Toastr
    • Transitions
    • Tree View
    • Tutorials
    • Typeahead
    • Typesense
    • UI
    • Uploader
    • UPS
    • User Groups
    • Users
    • Virtual Call Center
    • Vouchers
    • Webshop
    • WYSIWYG

Date

LicenseStableDownloadsJavaScriptnpmIssuesMerge Requests

Description

Date formatting helpers for Enso UI.

Installation

Install the package:

yarn add @enso-ui/date

Features

  • formats absolute dates using PHP-style Enso format strings
  • formats relative distances with locale-aware date-fns translations
  • ships the locale map used by the date helpers
  • converts Enso/PHP date tokens to date-fns Unicode tokens

Usage

import format from '@enso-ui/date/src/format';
import formatDistance from '@enso-ui/date/src/formatDistance';

format('2026-04-21', 'd.m.Y', 'ro');
formatDistance('2026-04-20', 'en');

API

format(date, formatStr, locale = 'en')

Formats a date using PHP-style tokens.

Import: @enso-ui/date/src/format.js

formatDistance(date, locale = 'en')

Formats a relative distance from now.

Import: @enso-ui/date/src/formatDistance.js

i18n

Locale map used by the date helpers.

Import: @enso-ui/date/src/i18n.js

unicode2php(formatStr)

Converts Enso/PHP date tokens to the date-fns token set used internally.

Import: @enso-ui/date/src/unicode2php.js

Depends On

  • date-fns

Contributions

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

License

MIT

Edit this page on GitHub
Last Updated: 4/21/2026, 10:00:51 AM
Prev
Data Import
Next
Datepicker