Update lib/utils.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
4e42ac5b89
commit
7c965b022d
|
|
@ -98,7 +98,7 @@ export const formatArticle = (
|
|||
});
|
||||
|
||||
export const formatChangePercent = (changePercent?: number) => {
|
||||
if (!changePercent) return '';
|
||||
if (changePercent === undefined || changePercent === null) return '';
|
||||
const sign = changePercent > 0 ? '+' : '';
|
||||
return `${sign}${changePercent.toFixed(2)}%`;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue