unocha/un_date
Composer 安装命令:
composer require unocha/un_date
包简介
UN date and time twig filters for Drupal 8
README 文档
README
See UN standard for details.
All dates will be outputted as entered, there's no automatic timezone conversion.
We support English, French, Spanish, Chinese and Arabic.
Warning: You need the patch to fix translation of abbreviated month names.
The Humand readable output of RRules is flaky.
Install
Run composer install unocha/un_date
Core date formatter service
This service is replaced by UnDateFormatter and will enforce the proper format for short, medium and long.
Formatters
There's support for the following
- Core datetime field
- Core datetime_range field
- Contrib daterange_timezone
- Contrib date_recur
Twig filters and functions
Input can be either a DateTime compatible object, a Drupal structured data item, a string or a timestamp.
Most filters have an option for month_format, either numeric, full or abbreviation (default numeric)
Filters
- un_date: Formatted as date
j.m.Y - un_time: Formatted as time
g.i a.m.|p.m. - un_datetime: Formatted as date and time
d.m.Y g.i a.m.|p.m. - un_html_datetime: Formatted as date and time
Y-m-dTH:i:s - un_daterange: Formatted as date and time
j.m.Y g.i a.m.|p.m. — g.i a.m.|p.m.orj.m.Y g.i a.m.|p.m. — j.m.Y g.i a.m.|p.m.if dates are different - un_daterange_times: Formatted as date and time
g.i a.m.|p.m. — g.i a.m.|p.m.orj.m.Y g.i a.m.|p.m. — j.m.Y g.i a.m.|p.m.if dates are different - un_timerange: Formatted as time
g.i a.m.|p.m. — g.i a.m.|p.m. - un_year: Formatted as
Y - un_month: Formatted as
m - un_month_full: Formatted as
F - un_month_abbr: Formatted as
M - un_day: Formatted as
j - un_hour: Formatted as
G,g,noon,midnight - un_minute: Formatted as
mor blank if zero - un_ampm: Formatted as
a.m.|p.m.or blank
Functions
Most function accept a DateRange (compatible) object or 2 DateTime inputs.
- un_is_same_date: identical
- un_is_same_day: on the same day
- un_is_same_month: in the same month and year
- un_is_same_year: in the same year
- un_is_all_day: all day event
- un_is_utc: using UTC timezone
- un_is_rtl: RTL locale
- un_separator: the separator used
- un_duration: Return duration as human readable string
Human readable RRUle
Currently using https://github.com/rlanvin/php-rrule but https://github.com/simshaun/recurr looks nicer
unocha/un_date 适用场景与选型建议
unocha/un_date 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.37k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 unocha/un_date 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 unocha/un_date 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-only
- 更新时间: 2021-06-03