WebApp【公共组件库】@前端(For Git Submodule)
chensiAb
2024-08-23 4057d97fbd1c830c8c15abcca00f51720b53e2ce
common/Tools.js
@@ -6,6 +6,8 @@
import moment from 'moment';
import Taro from '@tarojs/taro';
moment.locale('zh-cn');
export class Tools {
    /**
     * 显示消息
@@ -534,13 +536,12 @@
     * @return {String}
     */
    static transWeekIndexToDate(year, week, weekDay) {
        const yearStart = moment([year, 0, 1]);
        const dayLong = 24 * 60 * 60 * 1000;
        const firstWeekLong = (7 - yearStart.day()) * dayLong;
        const weeksLong = (week - 1) * 7 * dayLong;
        const weekDayLong = weekDay * dayLong;
        const dayTimestamp = yearStart.valueOf() + firstWeekLong + weeksLong + weekDayLong;
        return moment(dayTimestamp).format('YYYY-MM-DD');
        if (weekDay < 1 && weekDay > 7) {
            return '';
        }
        const weekDate = moment(year + '-' + week, 'YYYY-WW');
        const firstDay = weekDate.startOf('week');
        return firstDay.add(weekDay - 1, 'day').format('YYYY-MM-DD');
    }
    /**