marshmallow/nova-date-range-filter
Composer 安装命令:
composer require marshmallow/nova-date-range-filter
包简介
A Laravel Nova date range filter.
README 文档
README
Date Range Filter for Laravel Nova
Nova filter that displays a Date Range Picker instead of a select. This field also supports dark-mode, Nova 4 and Nova 5.
Install
Run this command in your nova project:
composer require marshmallow/nova-date-range-filter
How to use
Add the DateRangeFilter to your resource filters array.
public function filters(Request $request) { return [ new \Marshmallow\Filters\DateRangeFilter('created_at', 'Created date'), ]; }
Methods
addRange
With this method, you can set default date ranges that you use frequently. For instance ranges like today, yesterday, this month etc. Please check the example below.
(new DateRangeFilter('created_at', 'Created date')) ->addRange('Today', now()->startOfDay(), now()->endOfDay()) ->addRange('Yesterday', now()->subDay()->startOfDay(), now()->subDay()->endOfDay()) ->addRange('This week', now()->startOfWeek(), now()->endOfWeek()) ->addRange('Last 7 days', now()->subDays(7)->startOfDay(), now()->endOfDay()) ->addRange('Last 30 days', now()->subDays(30)->startOfDay(), now()->endOfDay()) ->addRange('This month', now()->startOfMonth(), now()->endOfMonth()) ->addRange('Last month', now()->startOfMonth()->subMonth(1), now()->startOfMonth()->subMonth(1)->endOfMonth()) ->addRange('This year', now()->startOfYear(), now()->endOfYear()),
showMonths
With this method, it will be possible to show more then just the current month.
(new DateRangeFilter('created_at', 'Created date')) ->showMonths(2),
dateFormat
Override the date format used by the picker (Flatpickr format tokens).
(new DateRangeFilter('created_at', 'Created date')) ->dateFormat('Y-m-d'),
placeholder
Set a custom placeholder for the filter input.
(new DateRangeFilter('created_at', 'Created date')) ->placeholder('Select a date range'),
enableTime (beta)
Enable the time selector when you select your date.
minTime (beta)
Set a min time that can be selected.
maxTime (beta)
Set a max time that can be selected.
Localization
The package supports localization for all text elements. The following translations are available out of the box:
- English (en)
- Dutch (nl)
- Ukrainian (uk)
If your language doesn't work in the calendar interface (using Flatpickr localization) itself, please let us know and we will add your language.
Customizing Translations
You can publish the translation files to customize them for your application:
php artisan vendor:publish --tag=nova-date-range-filter-translations
This will copy the translation files to your application's resources/lang/vendor/nova-date-range-filter directory, where you can modify them or add new languages.
Security
If you discover any security related issues, please email stef@marshmallow.dev instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
marshmallow/nova-date-range-filter 适用场景与选型建议
marshmallow/nova-date-range-filter 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 352.94k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2021 年 05 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「date」 「filter」 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 marshmallow/nova-date-range-filter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 marshmallow/nova-date-range-filter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 marshmallow/nova-date-range-filter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
Tools to convert between .NET and PHP date formats
Nova searchable filter for belongsTo relationships.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
统计信息
- 总下载量: 352.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 23
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-07