datepicker

How to detect date selection in ng-bootstrap Datepicker on input field?

六眼飞鱼酱① 提交于 2020-06-27 07:27:47
问题 We use the ng-bootstrap Datepicker as Directive in our project: <input class="form-control" name="dp" ngbDatepicker #d="ngbDatepicker" (blur)="d.close()" [(ngModel)]="model" (ngModelChange)="onDateSelected()"> The current behaviour is that onDateSelected() is called when a date in the datepicker is selected, as well as every time a change is made to the input field. The desired behaviour is that onDateSelected() is called whenever the user clicks on a date in the datepicker or moves the

Swift set default date to 10 years back

老子叫甜甜 提交于 2020-06-24 16:41:28
问题 I want to set the default date of picker view to 10 years back from current date. The code I have so far is this. let datePicker = UIDatePicker() datePicker.datePickerMode = UIDatePickerMode.date dateOfBirthTF.inputView = datePicker datePicker.addTarget(self, action: #selector(changed), for: .valueChanged) to get value change func changed(datePicker:UIDatePicker) { let dateFormatter = DateFormatter() dateFormatter.dateStyle = DateFormatter.Style.short let strDate = dateFormatter.string(from:

How can I change date format in angular material datepicker?

无人久伴 提交于 2020-06-14 07:28:49
问题 I want to change the default date format (YYYY-MM-DD) to some other format like (MM-DD-YYYY). This is my calendar HTML structure. <mat-form-field class="full-width"> <input matInput [matDatepicker]="picker" [(ngModel)]="currentDay" (dateChange)="currentDayChanged()" required placeholder="date" name="currentDay"> <mat-datepicker-toggle matSuffix [for]="picker"> </mat-datepicker-toggle> <mat-datepicker #picker></mat-datepicker> </mat-form-field> 回答1: There is a blog about it: https://blog

Setting DatePicker Value

泄露秘密 提交于 2020-06-11 16:40:28
问题 I currently have a program that takes the value from a datePicker and have the date saved as a string. I only needed the date not the time so i used the following code to save the date value: DateTime StartDate; String inMyString; savedDate = datePicker1.SelectedDate.Value.Date; inMyString = savedDate.Date.ToShortDateString() I have the inMyString pushedBack into my list and now i want to place it back into the datePicker. On MSDN is shows me the following example to set the date.

Restrict Range in Android DatePicker Custom Dialog

时光怂恿深爱的人放手 提交于 2020-06-08 20:12:54
问题 I have a custom linear layout which has DatePicker and TimePicker widgets in it. This is used as DateTime picker. I want to restrict the DatePicker by way of setMaxDate() and setMinDate() . I have done: dp.setMaxDate(new DateTime().minusDays(1).getMillis()); dp.setMinDate(new DateTime().minusDays(30).getMillis()); The dates beyond this range are actually grayed out when the dialog appears. But I can still select a grayed date. I have stumbled upon this. But, what is the work around for a

How to format x-axis based on how long between start and end time datepicker of data in chart.js?

自闭症网瘾萝莉.ら 提交于 2020-06-01 05:08:18
问题 Hello I am new to javascript. I have chart.js with the data from API look like this : .....//datepicker code...... $.ajax({ method: "GET", url: endpoint, data: { startDate: startDate, endDate: endDate }, success: function(data){ //get data by fields var accelero_x = [], timestamp = []; for (var i=0; i<data.length; i++){ accelero_x.push(data[i].accelero_x); timestamp.push(data[i].timestamp); } //plot the chart var ctx = document.getElementById("accelero_xChart").getContext('2d'); var accelero

SwiftUI: how to create custom UIDatePicker

旧时模样 提交于 2020-05-30 08:08:40
问题 I succeeded to create UIDatePicker inside SwifUI, but when I change the date wheel in picker the date value not update, here is my code: struct DatePicker: UIViewRepresentable { @Binding var date: Date func makeUIView(context: Context) -> UIDatePicker { let view = UIDatePicker() view.datePickerMode = .date return view } func updateUIView(_ uiView: UIDatePicker, context: Context) { uiView.date = date } } Then I call it from the view like this: struct SwiftUIView: View { @State var date = Date(

SwiftUI: how to create custom UIDatePicker

这一生的挚爱 提交于 2020-05-30 08:08:29
问题 I succeeded to create UIDatePicker inside SwifUI, but when I change the date wheel in picker the date value not update, here is my code: struct DatePicker: UIViewRepresentable { @Binding var date: Date func makeUIView(context: Context) -> UIDatePicker { let view = UIDatePicker() view.datePickerMode = .date return view } func updateUIView(_ uiView: UIDatePicker, context: Context) { uiView.date = date } } Then I call it from the view like this: struct SwiftUIView: View { @State var date = Date(

jQuery UI datepicker not working?

送分小仙女□ 提交于 2020-05-30 08:08:09
问题 I have the jQuery ui datepicker showing up in my web app, but when I go to choose a date, it doesn't do anything. And the default Html5 datepicker is still showing up. My datepicker image How can I disable the Html5 one for the jQuery Ui datepicker to work? This is how I did my code: Create.cshtml @Html.LabelFor(model => model.EnrollmentDate, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.EnrollmentDate, new { htmlAttributes =

Angular Material Datepicker | Lazy Loading + CustomDateAdapter + Internationalization - RangeError: Maximum call stack size exceeded

百般思念 提交于 2020-05-28 06:53:54
问题 Structure Question I'm not quite sure If I found the right place for this 2 code lines: providers: [ { provide: MAT_DATE_LOCALE, useValue: 'de-DE' }, { provide: DateAdapter, useClass: CustomDateAdapter, deps: [MAT_DATE_LOCALE, Platform] } ] Currently they are in my material.module => which is imported in shared.module => which is imported in app.module and every lazy loaded module. CustomDateAdapter: @Injectable() export class CustomDateAdapter extends NativeDateAdapter { subscription: any;