Start and end days of the next month in Fullcalendar month view - javascript

I need to get the Start and the End dates of the next/ preview month view when click the next or preview buttons in the Full Calendar.
Ex : Say current viewing month is January and when I click next button I need to get start and end dates February calendar view or when click preview button it should return December.
$('#calendarId’).fullCalendar('getView').start will return current view start and end dates
but i need to returning the other month (next or preview) start and end dates.
Explain : I am in the month view and i can get the all the start and end dates and current dates etc by using the available options in the calendar. But I need is just assume I have to obtain the next month start date and end date before i go the next or preview view by clicking next/preview button.

It sounds like if you are in the month view all you need is the month and year you have navigated to. From the month and year you can determine the begin and end date of that month. http://arshaw.com/fullcalendar/docs/current_date/getDate/.
From doc:
$('#calendar').fullCalendar('getDate');
To enable caching:
$('#calendar').fullCalendar({
events: {
url: '/myfeed.php',
cache: true
}
});

Thanks all,
I used default caching and events(as a function) feature in the Full calendar. http://arshaw.com/fullcalendar/docs2/event_data/events_function/

Related

Set EndDate value in SharePoint 13 to equal start date selected value

Working on a project in SP13 where calendar events are being set to all day events by default and all fields bar start date and title are hidden.
Issue is using the datepicker to select a start date in the future does not update the end date text field value, meaning it errors out when saving as end date cannot be earlier than start date. End date needs to be hidden so users can't manually set it to days other than the start date.
No success using jQuery so far. Looking for help.
You could use the below script to set end date to equal start date:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
function PreSaveAction(){
var startDate = $('input[title="Start Time Required Field"]').val();
$('input[title="End Time Required Field"]').val(startDate);
return true;
}
</script>

jQuery DateRangePicker - When changing start date, the end date also changes - why?

When I change the start date, the end date on my calendar changes to be the same. I want the start date to have no effect on the end date.
<input id="date" name="range">
$(function() { $("#date").daterangepicker(); });
If you set up your calendar as in the jQuery docs, you wont have this issue - you need two separate inputs for the date range:
https://jqueryui.com/datepicker/#date-range
Currently it appears to be changing the end date so it is no earlier than the start date range.

UIB Date Picker- Display previous day instead of present date (Plunker attached)

Plunker- http://plnkr.co/edit/RVKzD9kXNNxinShK7nLU?p=preview
I have a plunker which has the date displayed and a small icon where we can select any date we want and it will update it in the input field.
My problem is - i need to display the previous day when user opens the page. Currently here it displays presnt working day.
Also, while selecting previous day, i need not include weekends. i.e. saturday and sunday should be ignored. For e.g. today is 11th April. For previous date selection, i want 8th April to directly show up. 9th and 10th being saturday and sunday should be ignored.
Can someone please have a look.
Please ignore the below html code as it didnt allow me to post the question until i write some code. The plunker has the code which i am using.
<!doctype html>
</html>
You can do this by checking the date.getDay() and decrementing accordingly.
$scope.today = function () {
var lastWorking=new Date();
lastWorking.setDate(lastWorking.getDate()-1)
// 0 for Sunday and 6 for Saturday
while(lastWorking.getDay()==0 || lastWorking.getDay()==6){
lastWorking.setDate(lastWorking.getDate()-1);
}
$scope.tradeDate = lastWorking;
};
Updated Plunk

Bootstrap datepicker, disable dates - view only mode possible?

I'm loading a selection of dates into bootstrap datepicker for the user to view. Currently they can click on a highlighted date but it clears all the dates that are preloaded.
I don't want them to be able to click on any dates, just view the different month pages of dates. How can I do this?
this is how I setup datepicker and load the dates;
$('.datepickera').datepicker({
format: 'yyyy/mm/dd',
multidate: false
});
$.extend($.datepicker,{_checkOffset:function(inst,offset,isFixed){return offset}});
$(".datepickera").data("datepicker").setDates($('#mydates').data('dates'));
If I understand you correctly you can make the datepicker unselectable by using the daysOfWeekDisable property like this:
$('.datepicker').datepicker({
daysOfWeekDisabled: [0,1,2,3,4,5,6]
});
0 is Sunday and 6 is Saturday. This way a user cannot select any day but can view the entire calendar. You can read more about it here. Hope that helps.

How do I programmatically change the selected month in JQuery datepicker

I have a jQuery datepicker and I cannot figure out how to programmatically change the month back to the current month. After making a POST request to save the user's dates I need to return the calendar back to the current month. The calendar may be on a different month from the user playing around with different dates. I have tried setting the mindate again but that did not work.
This is not a popup calendar.
Setting the datepicker back to today
$('#myDatePicker').datepicker('setDate', new Date());
setting just the month back
var date = $('#myDatePicker').datepicker('getDate');
date.setMonth( (new Date()).getMonth() );
$('#myDatePicker').datepicker('setDate', date);
FIDDLE
You can also use .val() to set the date
$("#datepicker").val(date);

Categories

Resources