Доброго времени суток. Есть такой скрипт:
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<title>Документ без названия</title>
<link rel='stylesheet' href="fc/fullcalendar.css">
<style>
#calendar{
width :900px;
margin:auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
<script type="text/javascript" src="fc/lib/jquery.min.js"></script>
<script type="text/javascript" src="fc/lib/moment.min.js"></script>
<script type="text/javascript" src="fc/fullcalendar.js"></script>
<script type="text/javascript" src="fc/locale/ru.js"></script>
<script>
$(function(){
var usY = 2018,
usM = 10,
usD = 1,
chikL = 30,
mensDay = 4;
function dataUs(x,y,c){
var data_us = new Date(x,y,c), // дата пользователя
NoW_data_Micro = data_us.getTime(),
mas = NoW_data_Micro;
return mas;
}
//------------------------------------------------------------------------------------------ start
function plusDay(x){
var data_plus = new Date(1000 * 60 * 60 * 24 * x),
us_Mill = data_plus.getTime();
return us_Mill;
}
function start(){
var Us = dataUs(usY,usM,usD),
dataChikl = new Date(Us),
ChiklY = dataChikl.getFullYear(),
ChiklM = dataChikl.getMonth()+1,
ChiklD = dataChikl.getDate();
if(ChiklM < 10 && ChiklD < 10){
ChiklD = '0'+ ChiklD;
ChiklM = '0'+ ChiklM;
}
else if(ChiklM < 10){
ChiklM = '0'+ ChiklM;
}
else if(ChiklD < 10){
ChiklD = '0'+ ChiklD;
}
return `${ChiklY}-${ChiklM}-${ChiklD}`;
}
function end(){
var Us = dataUs(usY,usM,usD),
DaY = plusDay(chikL);
var i = 0;
var sum = Us + DaY,
dataChikl = new Date(sum),
ChiklY = dataChikl.getFullYear(),
ChiklM = dataChikl.getMonth()+1,
ChiklD = dataChikl.getDate();
if(ChiklM < 10 && ChiklD < 10){
ChiklD = '0'+ ChiklD;
ChiklM = '0'+ ChiklM;
}
else if(ChiklM < 10){
ChiklM = '0'+ ChiklM;
}
else if(ChiklD < 10){
ChiklD = '0'+ ChiklD;
}
return `${ChiklY}-${ChiklM}-${ChiklD}`;
}
//------------------------------------------------------------------------------------------ end
//------------------------------------------------------------------------------------------ start menst
function mensDay(x){
var data_plus = new Date(1000 * 60 * 60 * 24 * x),
us_Mill = data_plus.getTime();
return us_Mill;
}
function menstStart(){
var Us = dataUs(usY,usM,usD),
dataChikl = new Date(Us),
ChiklY = dataChikl.getFullYear(),
ChiklM = dataChikl.getMonth()+1,
ChiklD = dataChikl.getDate();
if(ChiklM < 10 && ChiklD < 10){
ChiklD = '0'+ ChiklD;
ChiklM = '0'+ ChiklM;
}
else if(ChiklM < 10){
ChiklM = '0'+ ChiklM;
}
else if(ChiklD < 10){
ChiklD = '0'+ ChiklD;
}
return `${ChiklY}-${ChiklM}-${ChiklD}`;
}
function menstEnd(){
var Us = dataUs(usY,usM,usD),
DaY = plusDay(mensDay);
var i = 0;
var sum = Us + DaY,
dataChikl = new Date(sum),
ChiklY = dataChikl.getFullYear(),
ChiklM = dataChikl.getMonth()+1,
ChiklD = dataChikl.getDate();
if(ChiklM < 10 && ChiklD < 10){
ChiklD = '0'+ ChiklD;
ChiklM = '0'+ ChiklM;
}
else if(ChiklM < 10){
ChiklM = '0'+ ChiklM;
}
else if(ChiklD < 10){
ChiklD = '0'+ ChiklD;
}
return `${ChiklY}-${ChiklM}-${ChiklD}`;
}
//------------------------------------------------------------------------------------------ end menst
//------------------------------------------------------------------------------------------ start ouk
function Fotin(x){
var data_plus = new Date(1000 * 60 * 60 * 24 * 21),
us_Mill = data_plus.getTime();
return us_Mill;
}
function Nytin(x){
var data_plus = new Date(1000 * 60 * 60 * 24 * 9),
us_Mill = data_plus.getTime();
return us_Mill;
}
function startO(x){
var fotin = Fotin(),
Us = dataUs(usY,usM,usD),
DaY = plusDay(chikL),
sum = Us + DaY,
okul = sum - fotin,
dataChikl = new Date(okul),
ChiklY = dataChikl.getFullYear(),
ChiklM = dataChikl.getMonth()+1,
ChiklD = dataChikl.getDate();
if(ChiklM < 10 && ChiklD < 10){
ChiklD = '0'+ ChiklD;
ChiklM = '0'+ ChiklM;
}
else if(ChiklM < 10){
ChiklM = '0'+ ChiklM;
}
else if(ChiklD < 10){
ChiklD = '0'+ ChiklD;
}
return [`${ChiklY}-${ChiklM}-${ChiklD}`];
}
function endO(x){
var fotin = Fotin(),
Us = dataUs(usY,usM,usD),
DaY = plusDay(chikL),
sum = Us + DaY,
okul = sum - fotin,
fotin = Nytin(),
okul1 = okul + fotin,
dataChikl = new Date(okul1),
ChiklY = dataChikl.getFullYear(),
ChiklM = dataChikl.getMonth()+1,
ChiklD = dataChikl.getDate();
if(ChiklM < 10 && ChiklD < 10){
ChiklD = '0'+ ChiklD;
ChiklM = '0'+ ChiklM;
}
else if(ChiklM < 10){
ChiklM = '0'+ ChiklM;
}
else if(ChiklD < 10){
ChiklD = '0'+ ChiklD;
}
return [`${ChiklY}-${ChiklM}-${ChiklD}`];
}
//------------------------------------------------------------------------------------------ end ouk
function test(){
var mas1 = [{
title: 'Ваш цикл',
start: `${start()}`,
end:`${end()}`
},
{
title: 'Дни менструации',
start: `${menstStart()}`,
end:` ${menstEnd()}`,
color: '#F0030F'
}
,{
title: 'Благоприятные дни',
start:`${startO()}`,
end:`${endO()}`,
color:` #E216AC`
},
{
title: 'Безопасные дни',
start: `${menstEnd()}`,
end: `${startO()}`,
color:`#47C100`
},
{
title: 'Безопасные дни',
start:`${endO()}`,
end:`${end()}`,
color:`#47C100`
}
];
return mas1;
}
console.log(test())
/* $('#calendar').fullCalendar({
events:test()
});*/
})
</script>
</body>
</html>
Он выводит объекты событий с датами в календарик. Дело вот в чем не могу понять как мне его зациклить. Он у меня выводи только данные за один месяц. Но в ручную писать 12 месяцев вперед и назад это горячка. Может кто знает как зациклить вывод на остальные месяцы? Он эти объекты выводит в специальную функцию которая предусмотрена в документации "fullcalendar". За ранее спасибо!