Skip to content

Support MM/DD/YYYY date format in timestamp column searches#20

Merged
jguo144 merged 2 commits into
masterfrom
jguo144/2026-03-31/accept-multiple-search-date-format
Mar 31, 2026
Merged

Support MM/DD/YYYY date format in timestamp column searches#20
jguo144 merged 2 commits into
masterfrom
jguo144/2026-03-31/accept-multiple-search-date-format

Conversation

@jguo144
Copy link
Copy Markdown
Collaborator

@jguo144 jguo144 commented Mar 31, 2026

Description

This PR adds support for MM/DD/YYYY date format in timestamp column searches, while maintaining backward compatibility with YYYY-MM-DD format.

Changes

  • Date format validation: Now accepts both YYYY-MM-DD and MM/DD/YYYY formats
  • Single date searches: Users can search timestamp columns using either 01/15/2024 or 2024-01-15
  • Date range searches: Supports ranges in both formats (e.g., 01/01/2024 to 12/31/2024)
  • Dynamic placeholders: Placeholder text adapts based on ckan.datatables.date_format config
    • If set to MM/DD/YYYY: shows "mm/dd/yyyy"
    • Otherwise: shows "yyyy-mm-dd"

Technical Details

  • Added _normalize_date() function to convert MM/DD/YYYY to YYYY-MM-DD for SQL queries
  • Enhanced _is_valid_date() to validate both formats
  • Single date searches are converted to same-day date ranges for accurate timestamp filtering

All changes are backward compatible. Existing YYYY-MM-DD searches continue to work as before.

@jguo144 jguo144 enabled auto-merge (squash) March 31, 2026 16:27
Copy link
Copy Markdown

@orca-security-us orca-security-us Bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@jguo144 jguo144 merged commit dcc35e7 into master Mar 31, 2026
9 checks passed
@jguo144 jguo144 deleted the jguo144/2026-03-31/accept-multiple-search-date-format branch March 31, 2026 17:12
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.

3 participants