zhuoyuan.wang
2024-06-19 15ebe96f28cadec6a726c5324593a40bbf56205f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import dayjs from 'dayjs';
import BigNumber from 'bignumber.js';
import * as tools from './tools.js';
 
export const date = (text) => {
  return text ? dayjs(text).format('YYYY-MM-DD') : '';
};
 
export const percent = (text) => {
  return text ? `${text}%` : ''
}
 
export const money = (text) => {
  return text ? `¥${text}` : ''
}
/**
 * * 100 + %
 * @param text
 */
export const percent100 = (text) => {
  return text ? `${new BigNumber(text).times(100)}%` : ''
}
 
 
export const decode = (text) => {
  return text ? tools.decode(text) : '';
}
 
 
export const formatDateformat = (format) => {
  return format ? format.replace(/y/g, 'Y').replace(/d/g, 'D') : ''
}