Skip to content

Conversation

hkong-mitre
Copy link
Contributor

Closes Issue #47

Summary

Enables search for dates and date ranges according to description/requirements in #47. Note this is a Pareto subset of the full possible formats for expressing dates and date ranges---we chose the 4 most useful and likely cases. Specifically:

  • date and date range search on date fields, using the following formats:
    • YYYY-MM-DD
    • YYYY-MM-DDTHH:MM:SS(.mmm)(Z) (where the .mmm and Z are optional, defaults to .000Z if missing)
    • YYYY-MM-DD..YYYY-MM-DD
    • YYYY-MM-DDTHH:MM:SS(.mmm)(Z)..YYYY-MM-DDTHH:MM:SS.(mmm)(Z)

Note that all date ranges are inclusive, that is, 2025-10-16..2025-10-17 will return CVEs in the 48 hour interval between those 2 dates.

Important Changes

  • changes in IsoDate/*.ts to better accommodate those 4 use cases (note that the code handles more than those 4 cases, so there is a superset of test cases. This was both for completeness as well as ease of transition if we accept more use cases in the future)
  • cleaned up search-related code in src/search to do dates and date range searches
  • SearchTokens renamed to SearchExpressions since they are not tokens per se, but expressions for OpenSearch query syntax. We adopted a slow transition period to migrate this class to the search code, since it is not strictly necessary until we search for strings and date ranges in the same query, something we do not yet allow in this sprint. They are being used in the snapshots, however.

Testing

  • npm run test:serial should pass without failures
  • any date or date range searches using the format above on dev should work as expected

Notes

  • we do not yet allow string and date searches yet, and may not until next release.

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