23 lines
454 B
TypeScript
23 lines
454 B
TypeScript
import moment from "moment"
|
||
|
||
/**
|
||
* 获取今天是今年的第几周,like 2024-05
|
||
*/
|
||
export const getWeekTimeWithYear = () => {
|
||
return moment().format("YYYY-WW")
|
||
}
|
||
|
||
/**
|
||
* 获取上周是今年的第几周,like 2024-04
|
||
*/
|
||
export const getPrevWeekWithYear = () => {
|
||
return moment().subtract(1, "weeks").format("YYYY-WW")
|
||
}
|
||
|
||
/**
|
||
* 秒转分钟,保留一位小数
|
||
*/
|
||
export const sec2min = (sec: number) => {
|
||
return (sec / 60).toFixed(1)
|
||
}
|