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') : ''
|
}
|