feat(dates): adding handling for first of#37098
Conversation
…andrusoare/feat/date-parse-improvements
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
We are not handling expressions like |
There was a problem hiding this comment.
Code Review Agent Run #38d2ff
Actionable Suggestions - 1
-
tests/unit_tests/utils/date_parser_tests.py - 1
- Missing tzinfo argument in datetime call · Line 619-620
Review Details
-
Files reviewed - 2 · Commit Range:
e46d328..b244049- superset/utils/date_parser.py
- tests/unit_tests/utils/date_parser_tests.py
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
| result = get_since_until("first of this month : ") | ||
| assert result == (datetime(2016, 11, 1), None) |
There was a problem hiding this comment.
Line 620 creates a datetime object without tzinfo argument. Add timezone information using datetime(..., tzinfo=timezone.utc) or the project's preferred timezone handling approach.
Code suggestion
Check the AI-generated fix before applying
| result = get_since_until("first of this month : ") | |
| assert result == (datetime(2016, 11, 1), None) | |
| result = get_since_until("first of this month : ") | |
| from datetime import timezone | |
| assert result == (datetime(2016, 11, 1, tzinfo=timezone.utc), None) |
Code Review Run #38d2ff
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
I have also been looking into alternatives for a library that could handle all of these cases so in the future we won t have to add these manually, I have tested the dateparser library but it doesn't cover all of our needs |
|
🎪 Showtime deployed environment on GHA for b244049 • Environment: http://44.251.130.183:8080 (admin/admin) |
|
🎪 Showtime deployed environment on GHA for a6f1871 • Environment: http://16.148.67.235:8080 (admin/admin) |
Code Review Agent Run #921248Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
(cherry picked from commit 8f35cc93673a56ba499510fbefabf9e4a46d8b6f)
- development-setup.md: update Node.js prerequisite from v20 to v22 LTS (PR #37223 — project minimum Node version upgraded) - importing-exporting-datasources.mdx: document that masked_encrypted_extra (sensitive connection parameters like service account JSON) is now included in database import/export (PR #38078) - security.mdx: add note that get_samples() enforces datasource-level access control, closing prior gap where unprivileged users could fetch sample rows (PR #36550) - exploring-data.mdx: document natural language time range expressions including new "first of" expressions (first day/week of month/quarter/year) supported in the Custom time range picker (PR #37098) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- theming.mdx: document ECharts array property overrides (PR #37965) — array values like color palettes are fully supported and replaced entirely (not merged); adds Array Property Overrides section with color palette example - configuring-superset.mdx: document PKCE support for database OAuth2 (PR #37067) — add PKCE section under Custom OAuth2 with code_challenge_method config and when to use it - cache.mdx: document ETag support for thumbnail/screenshot endpoints (PR #37663) — conditional GET with If-None-Match to avoid downloading unchanged images - exploring-data.mdx: document SQL Lab UX improvements (PRs #37298, #37694, #37756) — treeview table browser, Ctrl+F find widget, resizable panels; also adds time range natural language expressions section (PR #37098) - creating-your-first-dashboard.mdx: document Table chart features — boolean and categorical conditional formatting (PRs #36338, #37756), gradient toggle (PR #36280), HTML cell rendering with security note (PR #37685), column header tooltips from dataset descriptions (PR #37179), Display Controls modal in dashboard view (PR #36062) - databases.json: update StarRocks supports_catalog and supports_dynamic_catalog to true — the engine spec (PR #37026) already implemented full catalog support with get_catalog_names(), get_default_catalog(), and SHOW CATALOGS; the committed JSON was stale and did not reflect this Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SUMMARY
Add support for parsing "first of the month" and similar expressions in time filters.
Single date expressions:
Range expressions:
The key distinction is that "first of X" and "first day of X" return a single date, while "first week/month/quarter of X" returns a date range.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE
AFTER
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION