WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2024-07-20 9afd18034b1d43929cb0f8e8e9feda6b4c9c08f0
Merge branch 'master' of ssh://dev.zhiheiot.com:29418/mob-components
1 files modified
15 ■■■■ changed files
common/Tools.js 15 ●●●● patch | view | raw | blame | history
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');
    }
    /**