why not change year on material datepicker - javascript

why not change year and month on material datepicker
Here I add css and js:
<link rel="stylesheet" type="text/css" href="{{asset('assets/datepicker/bootstrap-material-datepicker/css/bootstrap-material-datepicker.css')}}">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script type="text/javascript" src="http://momentjs.com/downloads/moment.js"></script>
<script type="text/javascript" src="http://momentjs.com/downloads/moment-with-locales.js"></script>
<script type="text/javascript" src="{{asset('assets/datepicker/bootstrap-material-design/dist/js/material.min.js')}}"></script>
<script type="text/javascript" src="{{asset('assets/datepicker/bootstrap-material-datepicker/js/bootstrap-material-datepicker.js')}}"></script>
$('#datepicker_finish').bootstrapMaterialDatePicker({ weekStart : 0 });
$('#datepicker_start').bootstrapMaterialDatePicker({ weekStart : 0 }).on('change', function(e, date)
{
$('#datepicker_finish').bootstrapMaterialDatePicker('setMinDate', date);
});

The question is not clear
What i understand is you want to know why year picker is not available on material dataPicker
This was a problem with angular material but has been fixed.
Check this link
Make year selectable in angular material

Related

DateTime picker not working in in web app

I am trying to add this DateTime Picker to my application, I am not sure why. I already have the needed library to make it work.. Here are my libraries below:
<!-- jQuery library -->
<script src="js/jquery.min.js"></script>
<!-- Bootstrap library -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src="bootstrap/js/bootstrap.min.js"></script>
<link href="css/bootstrap-datetimepicker.css" rel="stylesheet">
And here is the code of the dateTime picker
<label for="dateTime">Date and Time</label>
<input type="text" name="datetime" id="datetime" class="form-control" readonly>
<script type="text/javascript">
$(function () {
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes();
var dateTime = date+' '+time;
$("#datetime").datetimepicker({
format: 'yyyy-mm-dd hh:ii',
autoclose: true,
todayBtn: true,
startDate: dateTime
});
});
</script>
Include the necessary scripts and styles:
<head>
<!-- ... -->
<script type="text/javascript" src="/bower_components/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/bower_components/moment/min/moment.min.js"></script>
<script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="/bower_components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" />
</head>

How to show whole month in calendar?

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">

Amsul DatePicker - How to load number of years in a select option?

I'm using Amsul DatePicker: https://amsul.ca/pickadate.js/date/#selectors and I'm unable to find out how can I load the number of required years in the year drop down. By default, it's coming like half the years before the current year and half the year after the current year.
So what I want to achieve is I want to load 150 years back from the current year.
Looking for help.
Thanks
$('.datepicker').pickadate({
selectYears: 100,
selectMonths: true,
min: true
})
<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 name="dob" type="text" class="form-control account-field-input datepicker">
Change your initial settings to include min and max dates.
var maxDate = new Date();
var minDate = new Date();
minDate.setFullYear( minDate.getFullYear() - 150 );
$('.datepicker').pickadate({
min: minDate,
max: maxDate,
selectYears: 150,
selectMonths: true
})
<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 name="dob" type="text" class="form-control account-field-input datepicker">

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>

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" />

Categories

Resources