GitHub user dosubot[bot] added a comment to the discussion: Jalali calendar 
support for time grain on Gregorian timestamps

<!-- Greeting -->
Hi @MohsenRazavi! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the 
superset team.

<!-- Answer -->
Superset does not natively support applying Jalali (Persian) calendar time 
grains (like day, month, year) directly on Gregorian timestamp columns. The 
Persian calendar support currently available is focused on the date filter UI, 
allowing users to select Jalali date ranges, but time grain computations (for 
grouping/aggregating data) are still based on the Gregorian calendar and 
handled by your database's date/time functions or SQL expressions [see 
details](https://github.com/apache/superset/pull/36111) [engine spec 
docs](https://github.com/apache/superset/blob/master/superset/db_engine_specs/README.md).

If you need Jalali-based time grains, you'll need to convert your Gregorian 
timestamps to Jalali in your database or via a custom SQL expression (for 
example, in a virtual dataset), and then aggregate/group by the Jalali date 
parts. There is no built-in feature for this conversion in Superset's time 
grain functionality as of now 
[reference](https://github.com/apache/superset/blob/master/superset/db_engine_specs/mysql.py)
 [reference](https://github.com/apache/superset/pull/30926).

If your database supports Jalali date functions or you can add a UDF for 
conversion, you can define a calculated column or custom SQL to extract Jalali 
year/month/day and use those for grouping.


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/11414bad-801a-46c2-8a17-d5ec28f8aa17?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/11414bad-801a-46c2-8a17-d5ec28f8aa17?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/11414bad-801a-46c2-8a17-d5ec28f8aa17?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/11414bad-801a-46c2-8a17-d5ec28f8aa17?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/11414bad-801a-46c2-8a17-d5ec28f8aa17?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/11414bad-801a-46c2-8a17-d5ec28f8aa17?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/11414bad-801a-46c2-8a17-d5ec28f8aa17?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Superset%20does%20not%20natively%20support%20applying%20Jalali%20%28Persian%29%20calendar%20time%20grains%20%28like%20day%2C%20month%2C%20year%29%20directly%20on%20Gregorian%20timestamp%20columns.%20The%20Persian%20calendar%20support%20currently%20available%20is%20focused%20on%20the%20date%20filter%20UI%2C%20allowing%20users%20to%20select%20Jalali%20date%20ranges%2C%20but%20time%20grain%20computations%20%28for%20grouping/aggregating%20data%29%20are%20still%20based%20on%20the%20Gregorian%20calendar%20and%20handled%20by%20your%20database%27s%20date/time%20functions%20or%20SQL%20expressions%C2%A0%5Bsee%20details%5D%28https%3A//github.com/apache/superset/pull/36111%29%C2%A0%5Bengine%20spec%20docs%5D%28https%3A//github.com/apache/superset/blob/master/super
 
set/db_engine_specs/README.md%29.%0A%0AIf%20you%20need%20Jalali-based%20time%20grains%2C%20you%27ll%20need%20to%20convert%20your%20Gregorian%20timestamps%20to%20Jalali%20in%20your%20database%20or%20via%20a%20custom%20SQL%20expression%20%28for%20example%2C%20in%20a%20virtual%20dataset%29%2C%20and%20then%20aggregate/group%20by%20the%20Jalali%20date%20parts.%20There%20is%20no%20built-in%20feature%20for%20this%20conversion%20in%20Superset%27s%20time%20grain%20functionality%20as%20of%20now%C2%A0%5Breference%5D%28https%3A//github.com/apache/superset/blob/master/superset/db_engine_specs/mysql.py%29%C2%A0%5Breference%5D%28https%3A//github.com/apache/superset/pull/30926%29.%0A%0AIf%20your%20database%20supports%20Jalali%20date%20functions%20or%20you%20can%20add%20a%20UDF%20for%20conversion%2C%20you%20can%20define%20a%20calculated%20column%20or%20custom%20SQL%20to%20extract%20Jalali%20year/month/day%20and%20use%20those%20for%20grouping.)&nbsp;[![Join
 Discord](https://img.shields.io/badge/join-
 
5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/37546)

GitHub link: 
https://github.com/apache/superset/discussions/37546#discussioncomment-15637583

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to