Skip to content

Commit

Permalink
fix: 🐛 fix utc date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSegullo committed Jun 7, 2024
1 parent 2ab7967 commit 43b1add
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions packages/web/components/chart/light-weight-charts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,5 @@ export const timepointToString = (
);
}

// from given date we should use only as UTC date or timestamp
// but to format as locale date we can convert UTC date to local date
const localDateFromUtc = new Date(
date.getUTCFullYear(),
date.getUTCMonth(),
date.getUTCDate(),
date.getUTCHours(),
date.getUTCMinutes(),
date.getUTCSeconds(),
date.getUTCMilliseconds()
);

return localDateFromUtc.toLocaleString(locale, formatOptions);
return date.toLocaleString(locale, formatOptions);
};

0 comments on commit 43b1add

Please sign in to comment.