Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timezone() Support to Laravel Trend for Custom Timezone Aggregations #76

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rtraselbd
Copy link

This update introduces the timezone() method to Laravel Trend, allowing users to specify a custom timezone for date aggregation operations. By setting a timezone, all date-based intervals (perMinute(), perDay(), etc.) are adjusted to the specified region, providing accurate data trends for specific time zones. This addition is especially beneficial for applications where data trends need to be localized, such as setting the timezone to "Asia/Dhaka" for users in Bangladesh.

Example usage:

Trend::model(Order::class)
    ->timezone('Asia/Dhaka')
    ->between(...)
    ->perDay()
    ->count();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant