jQuery UI Datepicker: Select date by click on weekday - jquery-ui

i want to select automatically dates by clicking the calendar header on a weekday like Thursday (Do) and get all thurtsday days of this month.
Is there any way to get an onlick event on the weekday header?
Example:
Click on "Do" (Thurthday) and 15,22,29 are selected.
Example 2:
Click on "Mo" (Monday) and 12,19,26 are selected.

Related

Refresh the material calendar

A problem with refresh the mat-calendar image. an initial current month of the calendar was displayed, but if I select any date of next month then the mat-calendar will not update with the next month.
expected result: select any date, mat calendar jump, or shows to the selected date
I try How to refresh mat-calendar after changing the background of highlighted dates also but still phasing with the above problem.
I also encountered this problem. Here is a solution (here I use moment.js. Date works just as well)
HTML
<mat-calendar #smallCalendar
[startAt]="smallCalendarStartAt"
[selected]="smallCalendarSelected">
</mat-calendar>
Typescript
// Small calendar properties
#ViewChild('smallCalendar', { static: false }) smallCalendar: MatCalendar<Date>;
smallCalendarStartAt: Date;
smallCalendarSelected: any;
// Refresh the small calendar
this.smallCalendarStartAt = new Date(moment().year(), +moment().format('MM'), +moment().format('DD'));
this.smallCalendarSelected = this.smallCalendarStartAt; // Update the selected day in mat-calendar
this.smallCalendar._goToDateInView(this.smallCalendarStartAt, 'month'); // Update the month in the mat-calendar
You can adapt the variable smallCalendarStartAt. Here, for the example, it will only switch to the next month with the day of the actual month
Here is a demo with the Date function: DEMO

Display Year, Month and Date in sequence on DateTimePicker iOS

Here is my situation, Current Date picker is showing date, month and year in sequence of Date, Month and Year OR Month, Date and Year. But I want to display this sequence as Year first then Month and at last Date.
I searched a lot but same question I found in Javascript but not in iOS, I also searched in Apple Documentation but I didn't find any solution.
How can I achieve this sequence Year, Month and Date? If there any property or method available for DateTime Picker? OR Do I need to use custom picker? if any then which?
Thanks.
The order of year, month and day is depending on the picker's locale.
Eg.
datePicker.locale = NSLocale(localeIdentifier: "zh_TW")
will have different order from
datePicker.locale = NSLocale(localeIdentifier: "en_US")

Knowing if the user wants the week to begin on a Sunday or Monday

There is a calendar setting in iOS that allows the user to change on what day the week-based calendar begins. I display a calendar in my app and want to be able to leverage this setting so the layout of my weekday columns matches those of the first party Calendar app.
Is there a way to do this? I've tried tapping the .firstWeekday property of NSCalendar but it always returns 1, regardless of setting.
Change your phone's region and try this:
let firstWeekday = Locale.current.calendar.firstWeekday
print(firstWeekday)
The console prints 1 when the region is en_US and 2 for en_FR (France), which correspond to Sunday and Monday respectively.

Is format also used to parse input string?

I'm using the datepicker popup with format='dd.MM.yyyy'. However, if the user is not using the datepicker, but instead enters the date by himself, the date is parsed as MM.dd.yyyy, i.e. month and day are mixed up.
The same thing can be done in the official demo page:
Scroll down to datepicker
Select dd.MM.yyyy as format in the format drop down
Enter 01.02.2014 in the "popup" field above - the resulting date will be Jan 2nd, not Feb 1st.
Is there any way to get the right behavior? Or is this a bug?

jQuery UI datepicker - Date Range - #to - set first month to display where numberOfMonths = 3 (it defaults to selected days month)

Hi, I have a 2 textboxes (#from and #to), with a date-range between them.
DateRange Datepicker
E.g. #from I select 10 October 2014
(The current popups show October,November,December)
Now at this stage the #to textbox has no value, when you click on the textbox, it shows from October 2014 which is absolutely perfect this is what I need. (I know this is because of the code in on onClose event as in the hyperlink).
The problem is that if I select e.g. December 2014 now in #to, and it closes, and I open #to again, it then shows December,January,February.
The requirement is that the user needs to not look forward in #to but he needs to see that the range was from October 2014 to December 2014 - and thus needs to see the three months on the screen as October,November, December and not the default 3 months that the jQuery UI Datepicker shows after a date has been selected.
Is it possible to set the first month that a 3 month calender has to display?

Resources