How to show whole month in calendar? - javascript

I'm using amsul datetimepicker: https://amsul.ca/pickadate.js/date/
Is there any way to show the current month in the calendar view? As you can see in the preview it has previous and next month dates as well. I just want to restrict it to 30 or 31 days of the current mont.
It will be a big help!
Thanks.
$('.datepicker').pickadate()
.picker__day--outfocus {
visibility: hidden;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://hateable-tests.000webhostapp.com/classic.css" rel="stylesheet">
<link href="https://hateable-tests.000webhostapp.com/classic.date.css" rel="stylesheet">
<link href="https://hateable-tests.000webhostapp.com/classic.time.css" rel="stylesheet">
<script src="https://hateable-tests.000webhostapp.com/picker.js"></script>
<script src="https://hateable-tests.000webhostapp.com/legacy.js"></script>
<script src="https://hateable-tests.000webhostapp.com/picker.date.js"></script>
<script src="https://hateable-tests.000webhostapp.com/picker.time.js"></script>
<input type="text" class="datepicker">

Unfortunately the amsul datepicker doesn't offer a built-in function to do this.
You can fake it using some custom css however.
Essentially overwrite the styles for picker__nav--prev & picker__nav--next and make them invisible.
To hide the days of the previous month/the next month in the current month's view you have to overwrite the style for picker__day--outfocus.
$('.datepicker').pickadate();
.picker__nav--prev {
visibility: hidden;
}
.picker__nav--next {
visibility: hidden;
}
.picker__day--outfocus {
visibility: hidden;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://hateable-tests.000webhostapp.com/classic.css" rel="stylesheet">
<link href="https://hateable-tests.000webhostapp.com/classic.date.css" rel="stylesheet">
<link href="https://hateable-tests.000webhostapp.com/classic.time.css" rel="stylesheet">
<script src="https://hateable-tests.000webhostapp.com/picker.js"></script>
<script src="https://hateable-tests.000webhostapp.com/legacy.js"></script>
<script src="https://hateable-tests.000webhostapp.com/picker.date.js"></script>
<script src="https://hateable-tests.000webhostapp.com/picker.time.js"></script>
<input type="text" class="datepicker">

Related

Jquery datetimepicker without time

I have a datetimepicker with format 'yyyy-mm-dd'.
Everything is working fine and it don't ask me for the time .
But if I add endDate it start asking me for the time.
Try this...
$(document).ready(function() {
$('#datetimepicker').datetimepicker({
format:'Y-m-d',
timepicker:false,
minDate:'-1970/01/02', //yesterday is minimum date
maxDate:'+1970/01/02' //tomorrow is maximum date
});
});
.dt{
margin-top:200px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input class="dt" type="text" id="datetimepicker"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://www.jqueryscript.net/demo/Clean-jQuery-Date-Time-Picker-Plugin-datetimepicker/jquery.datetimepicker.css"/>
<script src="https://www.jqueryscript.net/demo/Clean-jQuery-Date-Time-Picker-Plugin-datetimepicker/jquery.datetimepicker.js"></script>

I am using Bootstrap Datapicker show date in other place and highlight week end

I'm trying to use the Datapicker as a Calendar and want to selected date other "div" and weed ends change color can you provide my problem solution
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="custom.css" />
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/ui-lightness/jquery-ui.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<style type="text/css">
body {
font-family: Verdana, Arial, sans-serif;
font-size: 12px;
}
.ui-datepicker-week-end a {
color: red !important;
}
#calendar
{
background-color:#222;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$("#calendar").datepicker();
});
</script>
</head>
<body>
<form>
<div>
<div id="calendar"></div>
</div>
</form>
</body>
</html>
enter image description here
see above image 10th place i want selected date then and week end select then change color
First of all, the DevTools from Chrome browser is a good helper, just hint F12.
After running your code with DevTools open, you will see the error message in the Console panel:
Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4.
So just change your jQuery version to 1.12.4, jQueryUI version to 1.12.1, and the code works.
Good luck!

Bootstrap Daterange Picker Not Showing

I'm trying to add the daterange picker to my html file but cannot get it to show when i click on the input box. It works for datepicker, but i want it to offer to click on the range of dates. I've been struggling with these for days now and could really use some help. Extracted code is below. What am I missing?
`<!-- Include Required Prerequisites -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/3/css/bootstrap.css" />
<!-- Include Date Range Picker -->
<script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" />
<input type="text" name="daterange" value="01/01/2015 - 01/31/2015" />
<script type="text/javascript">
$(function() {
$('input[name="daterange"]').daterangepicker();
});
</script>`
<input type="text" class="daterange" value="01/01/2015 - 01/31/2015" />
<script type="text/javascript">
$('.daterange').daterangepicker();
</script>
try this.. may be it will help
Actually it is working as per your code.
$(function() {
$('input[name="daterange"]').daterangepicker();
});
I have created a fiddle for you. Please check it here
https://jsfiddle.net/nonh3gr7/
Also please do check in your html file if there any script conflict or something happened?
There is nothing wrong in the code check the working sample below
Here is a working JS fiddle https://jsfiddle.net/k956L4ep/
SNIPPET
$(function() {
$('input[name="daterange"]').daterangepicker();
});
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/3/css/bootstrap.css" />
<!-- Include Date Range Picker -->
<script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" />
<input type="text" name="daterange" value="01/01/2015 - 01/31/2015" />

fullCalendar Jquery plugin not appearing on page

I have tried to add the fullCalendar jquery to a view in my MVC 4 project. When I try to laod the page there are no errors but the calendar does not appear on the page. I am not sure why it isn't appearing and I have looked at the documentation and it looks like I got everything covered.
Here is my HTML:
#{
ViewBag.Title = "Calendar";
}
<h2>Calendar</h2>
<html>
<head>
<title>Calendar</title>
<link href="#Url.Content("~/Content/fullcalendar.css")" rel="stylesheet" type="text/css" />
<link href="#Url.Content("~/Content/fullcalendar.print.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="#Url.Content("/Scripts/moment.min.js")"></script>
<script type="text/javascript" src="#Url.Content("/Scripts/jquery.min.js")"></script>
<script type="text/javascript" src="#Url.Content("/Scripts/jquery-ui.custom.min.js")"></script>
<script type="text/javascript" src="#Url.Content("/Scripts/fullcalendar.min.js")"></script>
<script type="text/javascript">
$("#calendar").fullCalendar({
});
</script>
</head>
<body>
<div id="calendar"></div>
</body>
</html>
HERE IS MY CSS:
#calendar {
width: 900px;
margin: 40px auto;
}
Add refs to the libs you want to use;
<link rel='stylesheet' href='fullcalendar/fullcalendar.css' />
<script src='fullcalendar/lib/jquery.min.js'></script>
<script src='fullcalendar/lib/moment.min.js'></script>
<script src='fullcalendar/fullcalendar.js'></script>
<script type='text/javascript'>

jScrollPane error, is not a function

I'm trying to use jScrollPane and always get a Javascript error "jScrollPane is not a function". My Header looks like this
...
<link rel="stylesheet" type="text/css" href="assets/css/jquery.jscrollpane.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ruda" media="all" />
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="assets/js/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="assets/js/script.js"></script>
script.js contains this line of code:
$(window).load(function() {
$(function(){ $('.scrollbar').jScrollPane(); });
});
My div looks like this:
<div class="scrollbar"><p>...</p></div>
And has the following styles:
.scrollbar {
background: none repeat scroll 0 0 #FFFFFF;
max-height: 550px;
overflow: auto;
}
Whatever I tried, I keep getting this error and have absolutely no idea, how to get jScrollpane to function properly. Any help with this would be appreciated.

Categories

Resources