Skip to content

How to define a specific interval in time series of a day #3324

Answered by ckifer
bitgenerator asked this question in Q&A
Discussion options

You must be logged in to vote

You can define ticks yourself if you want like this:

const startTimeBeginningOfDay = new Date(data.startTime).setHours(0, 0, 0, 0);
const firstTickDate = new Date(startTimeBeginningOfDay);

const ticks = [
  startTimeBeginningOfDay,
  firstTickDate.setHours(6, 0, 0, 0),
  firstTickDate.setHours(12, 0, 0, 0),
  firstTickDate.setHours(18, 0, 0, 0),
  firstTickDate.setHours(23, 59, 0, 0)
];

https://codesandbox.io/s/even-distribution-ne5d8d-forked-4y0occ?file=/src/App.js

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ckifer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants