1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Facts: Always render YYYY-MM-DD dates with eight digits in chart tooltips

Summary:
Always render dates in tooltips when hovering over data points in Burndown charts etc of the Facts application as `YYYY-MM-DD` instead of `YYYY-M-D` by converting the integer to a string and if its length is only one character, prepend a zero.

Closes T15819

Test Plan:
* Enable the Facts application, go to the Reports of a Project with task changes over time, hover over data points and read the tooltip.
* Check Console of web browser's developer tools for no errors.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15819

Differential Revision: https://we.phorge.it/D25630
This commit is contained in:
Andre Klapper 2024-05-09 15:50:39 +02:00
parent ea554af476
commit 67b7181f52

View file

@ -194,9 +194,15 @@ JX.install('Chart', {
var d_y = dd.getFullYear();
// NOTE: Javascript months are zero-based. See PHI1017.
var d_m = dd.getMonth() + 1;
var d_m = (dd.getMonth() + 1).toString();
if (d_m.length == 1) {
d_m = '0' + d_m;
}
var d_d = dd.getDate();
var d_d = dd.getDate().toString();
if (d_d.length == 1) {
d_d = '0' + d_d;
}
var y = parseInt(d.y1);