gpt4 book ai didi

jquery - 自定义 View 中某些月份的问题 - FullCalendar.io

转载 作者:行者123 更新时间:2023-12-04 13:08:55 32 4
gpt4 key购买 nike

我有这样的自定义 View :

 views: {
dayGridMonthPersian:
{
type: "dayGrid",
buttonText: 'ماه شمسی',
visibleRange: function () {
const currentDate = new Date();
const thisMonthArray = GetStartEndMonth(currentDate);
return { start: thisMonthArray[0], end: thisMonthArray[1] }
},
},

在某个月份一切正常: enter image description here

但在某个月份我遇到了月份风格问题: enter image description here

我该如何解决这个问题??

最佳答案

可能对某些人有用。波斯月的第一天和最后一天:

    function GetStartEndMonth(currentDate) {
const splitDate = splitGeorgianDateToPersianDateArray(currentDate);
const year = splitDate[0];
const month = splitDate[1];
const lastDayOfPersianMonth = GetLastDayOfPersianMonth(month, year);

//Not Work in some Month !! => moment(currentPersianDate).clone().startOf('month').format('YYYY/MM/DD');
//Not Work at All in persian => moment(currentPersianDate).clone().endof('month').format('YYYY/MM/DD');
const startPersianMonth = year + "/" + month + "/" + 1;
const endPersianMonth = year + "/" + month + "/" + lastDayOfPersianMonth;

let startGeorgianDate = ConvertPersianDateStringToGeorgianDate(startPersianMonth);
let endGeorgianDate = ConvertPersianDateStringToGeorgianDate(endPersianMonth);
endGeorgianDate.setHours(23, 59, 59, 59);
const newMonthArray = [startGeorgianDate, endGeorgianDate];
return newMonthArray;
}

function GetLastDayOfPersianMonth(month, year) {
//محاسبه کبیسه
const leapMatch = [1, 5, 9, 13, 17, 22, 26, 30];
const number = year % 33;
const isLeap = leapMatch.includes(number);

if (month <= 6) {
return 31;
}
if (month > 6 && month < 12) {
return 30;
}
if (month == 12 && !isLeap) {
return 29;
}
if (month == 12 && isLeap) {
return 30;
}
}

function splitGeorgianDateToPersianDateArray(georgianDate) {
const persianStringDate = moment(georgianDate).locale('fa').format('YYYY/M/D');
const splitDate = persianStringDate.split("/");
const year = splitDate[0];
const month = splitDate[1];
const day = splitDate[2];
return [year, month, day];
}

关于jquery - 自定义 View 中某些月份的问题 - FullCalendar.io,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67764626/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com