problem when cloning jQuery UI datepicker

This works for me with jQuery UI 1.7.2 var mydiv = $(‘#someDiv’); mydiv.find(‘input.datefield’).datepicker(); var newDiv = mydiv.clone(false).attr(“id”, “someDiv2”).insertAfter(mydiv); newDiv.find(‘input.datefield’) .attr(“id”, “”) .removeClass(‘hasDatepicker’) .removeData(‘datepicker’) .unbind() .datepicker(); Check http://jsbin.com/ahoqa3/2 for a quick demo btw. you seem to have different errors in the code of your question. The css class is hasDatepicker not hadDatepicker and at one time … Read more

UIDatePicker in UIPopover

Try with below code. It will work fine: Objective-C – (IBAction)showDatePicker:(UIButton *)sender { UIDatePicker *datePicker = [[UIDatePicker alloc]init];//Date picker datePicker.frame = CGRectMake(0, 0, 320, 216); datePicker.datePickerMode = UIDatePickerModeDateAndTime; [datePicker setMinuteInterval:5]; [datePicker addTarget:self action:@selector(dateChanged:) forControlEvents:UIControlEventValueChanged];//need to implement this method in same class UIView *popoverView = [[UIView alloc] init]; //view popoverView.backgroundColor = [UIColor clearColor]; [popoverView addSubview:datePicker]; // … Read more

Fitting a UIDatePicker into a UIActionSheet

You can use something like this (adjust the coordinates): UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@”Date Picker” delegate:self cancelButtonTitle:@”Cancel” destructiveButtonTitle:nil otherButtonTitles:nil]; // Add the picker UIDatePicker *pickerView = [[UIDatePicker alloc] init]; pickerView.datePickerMode = UIDatePickerModeDate; [menu addSubview:pickerView]; [menu showInView:self.view]; [menu setBounds:CGRectMake(0,0,320, 500)]; CGRect pickerRect = pickerView.bounds; pickerRect.origin.y = -100; pickerView.bounds = pickerRect; [pickerView release]; [menu release]; But … Read more

How to change the format of date in date picker

In Apple’s documentation they specified that in UIDatePickerModeDate. The DatePicker displays months, days of the month, and years. The exact order of these items depends on the locale setting. An example of this mode is [ November | 15 | 2007 ]. But In device it display as DD/MM/YYYY. See UIDatePicker for more info. So … Read more

Limiting UIDatePicker dates from a particular time. Such as Input DOB to a restricted age limit

You can use dateByAddingUnit and subtract 16 years from current date to set the maximum date for your datePicker as follow: datePicker.maximumDate = NSCalendar.currentCalendar().dateByAddingUnit(.Year, value: -16, toDate: NSDate(), options: []) Xcode 10.2.1 • Swift 5 datePicker.maximumDate = Calendar.current.date(byAdding: .year, value: -16, to: Date())

UIDatePicker select Month and Year

Here is a solution to get the same effect. For using this snippet of code you should replace UIPickerView to CDatePickerViewEx in nib file in “Custom class” of “Indentity inspector”. .h file #import <UIKit/UIKit.h> @interface CDatePickerViewEx : UIPickerView <UIPickerViewDelegate, UIPickerViewDataSource> @property (nonatomic, strong, readonly) NSDate *date; -(void)selectToday; @end .m file #import “CDatePickerViewEx.h” // Identifiers of … Read more

iOS 7 – How to display a date picker in place in a table view?

With iOS7, Apple released the sample code DateCell. Demonstrates formatted display of date objects in table cells and use of UIDatePicker to edit those values. As a delegate to this table, the sample uses the method “didSelectRowAtIndexPath” to open the UIDatePicker control. For iOS 6.x and earlier, UIViewAnimation is used for sliding the UIDatePicker up … Read more

UIDatePicker pop up after UIButton is pressed

canihazcode? Yes, sir. Thanks for helping me procrastinating. – (void)changeDate:(UIDatePicker *)sender { NSLog(@”New Date: %@”, sender.date); } – (void)removeViews:(id)object { [[self.view viewWithTag:9] removeFromSuperview]; [[self.view viewWithTag:10] removeFromSuperview]; [[self.view viewWithTag:11] removeFromSuperview]; } – (void)dismissDatePicker:(id)sender { CGRect toolbarTargetFrame = CGRectMake(0, self.view.bounds.size.height, 320, 44); CGRect datePickerTargetFrame = CGRectMake(0, self.view.bounds.size.height+44, 320, 216); [UIView beginAnimations:@”MoveOut” context:nil]; [self.view viewWithTag:9].alpha = 0; [self.view … Read more

jQuery Date Picker – disable past dates

You must create a new date object and set it as minDate when you initialize the datepickers <label for=”from”>From</label> <input type=”text” id=”from” name=”from”/> <label for=”to”>to</label> <input type=”text” id=”to” name=”to”/> var dateToday = new Date(); var dates = $(“#from, #to”).datepicker({ defaultDate: “+1w”, changeMonth: true, numberOfMonths: 3, minDate: dateToday, onSelect: function(selectedDate) { var option = this.id == … Read more