DatePicker
As with other designs, there are two different design types in this component. See the following code block for sample use.
$('.fo-select-outlined').select2({
width: '100%',
minimumResultsForSearch: Infinity,
containerCssClass: 'outlined-filter'
});
// Changeable month, year and time
$('.fo-datetimepicker-changeable').datetimepicker({
controlType: 'select',
oneLine: true,
changeMonth: true,
changeYear: true,
timeFormat: 'hh:mm tt'
});
Information; https://api.jqueryui.com/datepicker/ and github.com/trentrichardson/jQuery-Timepicker-Addon
DatePicker Range
See the following code block for sample use.
// Defined
$(function () {
$('#daterange').daterangepicker({
"locale": {
"format": "DD.MM.YYYY",
"separator": " - ",
"applyLabel": "Uygula",
"cancelLabel": "İptal",
"fromLabel": "Buradan",
"toLabel": "Buraya",
"customRangeLabel": "Özel Aralık",
"weekLabel": "H",
"daysOfWeek": [
"Pz",
"Pa",
"Sa",
"Ça",
"Pe",
"Cu",
"Ct"
],
"monthNames": [
"Ocak",
"Şubat",
"Mart",
"Nisan",
"Mayıs",
"Haziran",
"Temmuz",
"Ağustos",
"Eylül",
"Ekim",
"Kasım",
"Aralık"
],
"firstDay": 1
},
//"timePicker": true, // time picker açmak için
//"showDropdowns": true, // ay ve yıl için dropdown çıkarmak için
"startDate": "10.06.2020", // başlangıç tarihi
"endDate": "11.07.2020", // bitiş tarihi
"drops": "auto", // açılan kutunun altta ya da üstte olmasını otomatik ayarlıyor
"buttonClasses": "fo-button fo-button-small", // buton class
"applyButtonClasses": "fo-button fo-button-small", // apply buton class
"cancelClass": "fo-button-secondary fo-button-small mr-1", // cancel buton class
"showCustomRangeLabel": false
}, function (start, end, label) {
// console.log("Seçilen tarih: " + start.format('DD-MM-YYYY') + ' tarihinden ' + end.format('DD-MM-YYYY')); // Test için
});
});
// Date Range Defined
$(function () {
$('#daterangedefined').daterangepicker({
ranges: {
'Bugün': [moment(), moment()],
'Dün': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Son 7 Gün': [moment().subtract(6, 'days'), moment()],
'Son 30 Gün': [moment().subtract(29, 'days'), moment()],
'Bu Ay': [moment().startOf('month'), moment().endOf('month')],
'Geçen Ay': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
"locale": {
"format": "DD.MM.YYYY",
"separator": " - ",
"applyLabel": "Uygula",
"cancelLabel": "İptal",
"fromLabel": "Buradan",
"toLabel": "Buraya",
"customRangeLabel": "Özel Aralık",
"weekLabel": "H",
"daysOfWeek": [
"Pz",
"Pa",
"Sa",
"Ça",
"Pe",
"Cu",
"Ct"
],
"monthNames": [
"Ocak",
"Şubat",
"Mart",
"Nisan",
"Mayıs",
"Haziran",
"Temmuz",
"Ağustos",
"Eylül",
"Ekim",
"Kasım",
"Aralık"
],
"firstDay": 1
},
"startDate": "10.06.2020",
"endDate": "11.07.2020",
"drops": "auto",
"buttonClasses": "fo-button fo-button-small",
"applyButtonClasses": "fo-button fo-button-small",
"cancelClass": "fo-button-secondary fo-button-small mr-1",
}, function (start, end, label) {
// console.log("Seçilen tarih: " + start.format('DD.MM.YYYY') + ' tarihinden ' + end.format('DD.MM.YYYY')); // Test için
});
});
// Clear Button
$(function () {
$('#daterangeClear').daterangepicker({
"autoUpdateInput": false,
"buttonClasses": "fo-button fo-button-small",
"applyButtonClasses": "fo-button fo-button-small",
"cancelClass": "fo-button-secondary fo-button-small mr-1",
"locale": {
"format": "DD.MM.YYYY",
"separator": " - ",
"applyLabel": "Uygula",
"cancelLabel": "Temizle",
"fromLabel": "Buradan",
"toLabel": "Buraya",
"customRangeLabel": "Özel Aralık",
"weekLabel": "H",
"daysOfWeek": [
"Pz",
"Pa",
"Sa",
"Ça",
"Pe",
"Cu",
"Ct"
],
"monthNames": [
"Ocak",
"Şubat",
"Mart",
"Nisan",
"Mayıs",
"Haziran",
"Temmuz",
"Ağustos",
"Eylül",
"Ekim",
"Kasım",
"Aralık"
],
"firstDay": 1
},
});
$('#daterangeGate').on('apply.daterangepicker', function (ev, picker) {
$(this).val(picker.startDate.format('DD.MM.YYYY') + ' - ' + picker.endDate.format('DD.MM.YYYY'));
});
$('#daterangeGate').on('cancel.daterangepicker', function (ev, picker) {
$(this).val('');
});
});
Options
- startDate
- (Date or string) The beginning date of the initially selected date range. If you provide a string, it must match the date format string set in your locale setting.
- endDate:
- (Date or string) The end date of the initially selected date range.
- minDate:
- (Date or string) The earliest date a user may select.
- maxDate:
- (Date or string) The latest date a user may select.
- maxSpan:
- (object) The maximum span between the selected start and end dates. Check off maxSpan in the configuration generator for an example of how to use this. You can provide any object the moment library would let you add to a date.
- showDropdowns:
- (true/false) Show year and month select boxes above calendars to jump to a specific month and year.
- minYear:
- (number) The minimum year shown in the dropdowns when showDropdowns is set to true.
- maxYear:
- (number) The maximum year shown in the dropdowns when showDropdowns is set to true.
- showWeekNumbers:
- (true/false) Show localized week numbers at the start of each week on the calendars.
- showISOWeekNumbers:
- (true/false) Show ISO week numbers at the start of each week on the calendars.
- timePicker:
- (true/false) Adds select boxes to choose times in addition to dates.
- autoUpdateInput:
- (true/false) Adds select boxes to choose times in addition to dates.
- singleDatePicker:
- (true/false) Adds select boxes to choose times in addition to dates.
- showDropdowns:
- (true/false) Adds select boxes to choose times in addition to dates.
More information; http://www.daterangepicker.com/#options