Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex timescale validators #43

Open
xdmorgan opened this issue May 21, 2020 · 0 comments
Open

Regex timescale validators #43

xdmorgan opened this issue May 21, 2020 · 0 comments

Comments

@xdmorgan
Copy link
Owner

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

No branches or pull requests

1 participant