Skip to content

Regex timescale validators #43

@xdmorgan

Description

@xdmorgan

Do timescales through pure functions which create regexes for timestamps and filter that way
function returns a generated validator(): bool for 'this month', then filter data: data.filter(validator). Internally, it more or less runs const validator = s => /^2020/.test(s).

  • This month - /^2020-05/.test(timestamp)
  • Last 90 days - this can be done with regex but it should return a function which does some more involved logic and returns boolean (for filtering)
  • Last 6 months - /^2020/.test(timestamp)
  • This year - /^2020/.test(timestamp)
  • Last year - /^2019/.test(timestamp) (this year - 1)
  • All-time - true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions