This is a migrated thread and some comments may be shown as answers.

Is there a method that only returns the day of the week?

3 Answers 8 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
NHJ
Top achievements
Rank 1
NHJ asked on 03 Jan 2020, 02:28 AM
I need a method to select and use the day of the week, Mon, Tue Wed, Thu, Fri, Sat.

Is there such a method?

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 06 Jan 2020, 02:56 PM

Hi Nam Hyuck,

This could be achieved by using JavaScript getDay() method that will return an integer from 0 (Sunday) to 6 (Saturday).  Then it could be mapped onto a string for that day of the week. For more information please refer to the following Stack Overflow thread: https://stackoverflow.com/a/31953070/12355063

The value of the DatePicker could be gotten with value method of the widget:

$("#datepicker").kendoDatePicker({
    value: new Date(2013, 10, 12)
});

var datepicker = $("#datepicker").data("kendoDatePicker");
var value = datepicker.value();
var date = value.getDay()
console.log(date);

Let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
NHJ
Top achievements
Rank 1
answered on 07 Jan 2020, 01:26 AM
Hello,

Unfortunately this is not the way I wanted to.

For example, when you pick January 7, 20, you don't want a result called "Tuesday."

Year Month Day? Uneven

I just want a sort of Picker function that consists of "day of the week" regardless of the date.

Does that exist?
0
Nikolay
Telerik team
answered on 08 Jan 2020, 03:54 PM

Hi Nam Hyuck,

As for now, the DatePicker has no method returning the day of the week.  If you would like we could convert this thread to a feature request.

Still, the value() method could be modified so the returned result is the day of the week:

var datepicker = $("#datepicker").data("kendoDatePicker");
var value = datepicker.value().toString();
var dayOfWeek = value.substring(0, 3);

This could be observed in the following Dojo demo: https://dojo.telerik.com/AgeyIjoq

Let me know if you have further questions.

Regards,
Nikolay
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Date/Time Pickers
Asked by
NHJ
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
NHJ
Top achievements
Rank 1
Share this question
or