Add role table

This commit is contained in:
2023-11-10 11:57:55 +08:00
parent cece8b2a83
commit 66c88fec48
8 changed files with 313 additions and 16 deletions

View File

@@ -144,3 +144,16 @@ export const getRedirectUrl = (path: string, redirectUrl: string): string => {
export const getLocalTime = (utcTime: string, format: string = 'yyyy-MM-DD HH:mm:ssZ') => {
return moment.utc(utcTime).local().format(format)
}
export const floorNumber = (num: number, digits: number) => {
if (digits > 0) {
return Math.floor(num / Math.pow(10, digits - 1)) * Math.pow(10, digits - 1)
} else {
const regExpMatchArray = num.toString().match(new RegExp('^\\d\\.\\d{' + -digits + '}'))
if (regExpMatchArray !== null) {
return parseFloat(regExpMatchArray[0]).toFixed(-digits)
} else {
return num
}
}
}