Skip to content

Conversation

@davidchuang5
Copy link
Contributor

Overview

  • User's input in 'From' and 'Until' are compared to times on process logs
  • Process logs containing times within 'From' and 'Until' time range are displayed
  • Process logs containing times out of time range are not displayed
  • Failure to input anything, or deletion of inputs resets state, and displays all process logs

All process logs are within time range
Screenshot 2023-06-26 at 7 47 15 PM

Process logs are no longer within time range
Screenshot 2023-06-26 at 7 49 21 PM

Deletion of input or no input at all renders all process logs
Screenshot 2023-06-26 at 7 52 01 PM

setFromTimestamp(e.target.value);
setValidFromTimestamp(checkValidity(e.target.value) ? e.target.value : '');
}}
error={Number.isNaN(Date.parse(fromTimestamp || '0'))}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can now resuse the checkValidity function here too:

error={!checkValidity(fromTimestamp || '0')}

I think a better name for the function would be isTimestampValid

  • It is declarative and tells you what the function is checking
  • Functions that return a boolean are often named this way; you can easily deduce what the function does

@davidchuang5 davidchuang5 merged commit 269bc5a into dev Jun 27, 2023
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.

4 participants