Skip to content

Conversation

@alexandrusoare
Copy link
Contributor

@alexandrusoare alexandrusoare commented Jan 13, 2026

SUMMARY

Add support for parsing "first of the month" and similar expressions in time filters.

Single date expressions:

  • "first of the month" → Nov 1
  • "first of this month" → Nov 1
  • "first of last month" → Oct 1
  • "first day of this week" → Nov 7

Range expressions:

  • "first week of this year" → Jan 1 to Jan 8
  • "first month of the quarter" → Oct 1 to Nov 1

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

image

AFTER

image

TESTING INSTRUCTIONS

  • Added unit tests for all new expression patterns
  • Verified existing date parser tests still pass

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@netlify
Copy link

netlify bot commented Jan 13, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit b244049
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69664f78508e3a0008fb9fcd
😎 Deploy Preview https://deploy-preview-37098--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@msyavuz
Copy link
Member

msyavuz commented Jan 14, 2026

We are not handling expressions like first two weeks of next month right? Should we? Also i think node has chrono for parsing nl dates, is there anything like that for python?

@alexandrusoare alexandrusoare marked this pull request as ready for review January 14, 2026 10:54
@dosubot dosubot bot added the change:backend Requires changing the backend label Jan 14, 2026
Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #38d2ff

Actionable Suggestions - 1
  • tests/unit_tests/utils/date_parser_tests.py - 1
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

AI Code Review powered by Bito Logo

Comment on lines +619 to +620
result = get_since_until("first of this month : ")
assert result == (datetime(2016, 11, 1), None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tzinfo argument in datetime call

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
Suggested change
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

@alexandrusoare
Copy link
Contributor Author

We are not handling expressions like first two weeks of next month right? Should we? Also i think node has chrono for parsing nl dates, is there anything like that for python?

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

@yousoph yousoph added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Jan 14, 2026
@github-actions github-actions bot added 🎪 b244049 🚦 building Environment b244049 status: building 🎪 b244049 📅 2026-01-14T23-57 Environment b244049 created at 2026-01-14T23-57 🎪 b244049 🤡 yousoph Environment b244049 requested by yousoph 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Jan 14, 2026
@github-actions
Copy link
Contributor

🎪 Showtime is building environment on GHA for b244049

@github-actions github-actions bot added 🎪 b244049 🚦 deploying Environment b244049 status: deploying 🎪 b244049 🚦 running Environment b244049 status: running 🎪 🎯 b244049 Active environment pointer - b244049 is receiving traffic 🎪 b244049 🌐 44.251.130.183:8080 Environment b244049 URL: http://44.251.130.183:8080 (click to visit) and removed 🎪 b244049 🚦 building Environment b244049 status: building 🎪 b244049 🚦 deploying Environment b244049 status: deploying 🎪 b244049 🚦 running Environment b244049 status: running 🎪 🎯 b244049 Active environment pointer - b244049 is receiving traffic labels Jan 15, 2026
@github-actions
Copy link
Contributor

🎪 Showtime deployed environment on GHA for b244049

Environment: http://44.251.130.183:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions github-actions bot added 🎪 a6f1871 🚦 building Environment a6f1871 status: building 🎪 a6f1871 📅 2026-01-15T11-32 Environment a6f1871 created at 2026-01-15T11-32 🎪 a6f1871 🤡 alexandrusoare Environment a6f1871 requested by alexandrusoare labels Jan 15, 2026
@github-actions
Copy link
Contributor

🎪 Showtime is building environment on GHA for a6f1871

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI finished reviewing your PR.

@github-actions github-actions bot added 🎪 a6f1871 🚦 deploying Environment a6f1871 status: deploying 🎪 a6f1871 🚦 running Environment a6f1871 status: running 🎪 🎯 a6f1871 Active environment pointer - a6f1871 is receiving traffic 🎪 a6f1871 🌐 16.148.67.235:8080 Environment a6f1871 URL: http://16.148.67.235:8080 (click to visit) 🎪 a6f1871 📅 2026-01-15T11-33 Environment a6f1871 created at 2026-01-15T11-33 and removed 🎪 a6f1871 🚦 building Environment a6f1871 status: building 🎪 a6f1871 🚦 deploying Environment a6f1871 status: deploying 🎪 a6f1871 🚦 running Environment a6f1871 status: running 🎪 🎯 a6f1871 Active environment pointer - a6f1871 is receiving traffic 🎪 a6f1871 📅 2026-01-15T11-32 Environment a6f1871 created at 2026-01-15T11-32 🎪 b244049 🚦 running Environment b244049 status: running 🎪 b244049 🌐 44.251.130.183:8080 Environment b244049 URL: http://44.251.130.183:8080 (click to visit) 🎪 b244049 🤡 yousoph Environment b244049 requested by yousoph 🎪 b244049 📅 2026-01-14T23-57 Environment b244049 created at 2026-01-14T23-57 labels Jan 15, 2026
@github-actions
Copy link
Contributor

🎪 Showtime deployed environment on GHA for a6f1871

Environment: http://16.148.67.235:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 15, 2026

Code Review Agent Run #921248

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: b244049..a6f1871
    • 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

AI Code Review powered by Bito Logo

@alexandrusoare alexandrusoare merged commit 81fdc2b into master Jan 15, 2026
65 checks passed
@alexandrusoare alexandrusoare deleted the alexandrusoare/feat/date-parse-improvements branch January 15, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎪 a6f1871 🤡 alexandrusoare Environment a6f1871 requested by alexandrusoare 🎪 a6f1871 🚦 running Environment a6f1871 status: running 🎪 a6f1871 🌐 16.148.67.235:8080 Environment a6f1871 URL: http://16.148.67.235:8080 (click to visit) 🎪 a6f1871 📅 2026-01-15T11-33 Environment a6f1871 created at 2026-01-15T11-33 change:backend Requires changing the backend size/L 🎪 ⌛ 48h Environment expires after 48 hours (default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants