question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for user-defined formatting of time values

See original GitHub issue

Hi,

By setting tick formatters in ‘values’ in an axis, I can show timestamps in 24h format. But the selected “Time” is always printed in 12h format with am/pm. I would like to print that in 24h format as well.

I added an option ‘timeSeriesVal’, by changing this line in Line.js:

const _timeSeriesVal = timeSeriesVal(tzDate);

to:

const _timeSeriesVal = opts.timeSeriesVal ? opts.timeSeriesVal(tzDate) : timeSeriesVal(tzDate);

and with this I can pass my own formatting function. I’m not sure this is the right way to do it though; specifically I’m not sure the name of this option is correct / descriptive.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
leeoniyacommented, Jan 3, 2020

ok, series.value can now be a template string and will respect opts.tzDate.

let opts = {
  tzDate: ts => uPlot.tzDate(new Date(ts * 1e3), 'Europe/London'),
  series: [
    {
      value: "{YYYY}-{MM}-{DD} {HH}:{mm}:{ss}"
    }
  ]
}
0reactions
leeoniyacommented, Jan 4, 2020

closing this issue in favor of #87 to stay on topic. i’ve added some more thoughts/concerns there. let me know what you think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom date and time formats for the Format function (Access ...
Learn how to control how a date or time is displayed by creating a custom formatting.
Read more >
236-29: Building and Using User Defined Formats
Formats are created using PROC FORMAT. User defined formats can be used to: ! convert numeric variables into character values.
Read more >
Formatting user-defined types with {fmt} library - [wgml.pl]
It claims to be faster than alternatives both in compile and run times, without bloating application code, too. It also supports formatting time...
Read more >
Time formatting for charts | Looker - Google Cloud
Format Type Description Use This Expression Time Milliseconds as a decimal number, i.e. 000 to 999 %L Time Second as a two‑digit number, i.e. 00...
Read more >
SimpleDateFormat (Java Platform SE 7 ) - Oracle Help Center
Date and Time Patterns · Text: For formatting, if the number of pattern letters is 4 or more, the full form is used;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found