Add previous timestamp to tickFormatter #1317
jamesarosen
started this conversation in
Ideas
Replies: 1 comment
-
This is more-or-less possible with the existing function tickMarkFormatter(seconds, tickMarkType) {
const date = new Date(seconds * 1000)
if (tickMarkType === TickMarkType.DayOfMonth) {
return new Intl.DateTimeFormat('default', { day: '2-digit', }).format(date)
} else if (tickMarkType === TickMarkType.Month) {
return new Intl.DateTimeFormat('default', { month: 'short', day: '2-digit' }).format(date)
}
} produces
But if the user is zoomed in to a particular day, all the tick marks get
(And similarly for days in the middle of a month.) I think regardless of the zoom level, there should always be at least two different |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd love to be able to have my
tickFormatter
return more concise information for most points, but more detailed information when relevant.For example:
Or:
The only way to know to add the
May
or to replace00:00
withMarch 13
is if I can tell that the current tick has crossed some threshold from the previous tick.Thus, I propose:
previousTime
would beundefined
for the first (leftmost) tick.Beta Was this translation helpful? Give feedback.
All reactions