JQuery DatePicker show only the Month and Year
Tech-Today

JQuery DatePicker show only the Month and Year


I have created a report search form that filter the monthly record of sales. So I don't really care about the specific day but the month.

Jquery has a nice DatePicker library, but it can't be customized to remove the month part, so just hide it with this code:

 $(".monthPicker").datepicker({
dateFormat: 'yy-mm',
changeMonth: true,
changeYear: true,
showButtonPanel: true,

onClose: function (dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).val($.datepicker.formatDate('yy-mm', new Date(year, month, 1)));
}
});

$(".monthPicker").focus(function () {
$(".ui-datepicker-calendar").hide();
$("#ui-datepicker-div").position({
my: "center top",
at: "center bottom",
of: $(this)
});
});

Note: While I customized the code to my liking, it's not my original. It came from several google source.




- How To Display A Date With Textfield Click With Swift
Displaying Date with TextField Click with Swift First you must have a textfield connected to storyboard. @IBOutlet weak var txtField_helloDatePicker: UITextField! Next you should have a constant of UIDatePicker type. let datePicker...

- Display Time Picker On Textfield Click In Xcode
Open Xcode and create a new Single View Application. For product name, use TextFieldTimePicker and then fill out the Organization Name and Company Identifier with your customary values. Select iPhone for Devices. For setting up the user interface, first,...

- Adding Loading Screen To C# Mvc Ajax Dialog Form Using Jquery
With my experience from telerik, I want my entity's add and edit form to be a popup so I don't have to change screen. I'm using C# MVC3, so I tried to look for jquery add on that would do the job. Fortunately I've come up with this article:...

- Android's Datepickerdialog And Timepickerdialog Implementation
Layout (calendar.xml) Java Class: package org.ipiel.demo.layout; import java.text.DateFormat; import java.util.Calendar; import android.app.Activity; import android.app.DatePickerDialog; import android.app.TimePickerDialog; import android.os.Bundle;...

- Flexigrid's On Row Click - How To Implement Rowclick Action Of Flexigrid Using Codeigniter's Library
The objective of this writing is to update the flexigrid library so that it can handle the rowClick event. To do this we need to download the latest version of flexigrid's library here: http://flexigrid.eyeviewdesign.com/, extract and setup accordingly...



Tech-Today








.