Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to change Kendo UI MVC DateTimePicker (v2021) to show like Persian DateTimePicker?
all internet links are belong to v2018 and when I do the same thing for v2021 that not working
for example I did changes like this video
this GitHub project work great for v2018
I do not know how to change kendo js files in v2021

What I have tried:

according to this video I downloaded attacked files and
I copy paste below files to Kendo.all.min.js file
1)kendo.jalalidate.min.js
2)kendo.culture.fa-IR.min.js
3)kendo.persiandatepicker.min.js
4)kendo.persiancalendar.min.js
then change these functions parameters name according what it is in kendo.all.min.js and pasted them in place that is shown in video
JavaScript
var toString = function (value, fmt, culture) {
    if (fmt) {
        if (objectToString.call(value) === '[object Date]' || value instanceof JalaliDate) {
            return formatDate(value, fmt, culture);
        } else if (typeof value === NUMBER) {
            return formatNumber(value, fmt, culture);
        }
    }
    return value !== undefined ? value : '';
};

function internalParseDate(value, formats, culture, strict) {
    if (culture = "fa-IR") {
        if (objectToString.call(value) === '[object Date]' || value instanceof JalaliDate)
            return value;
        if (formats != undefined) {
            if (value !== null && value !== "" && value != undefined && (formats == "yyyy/MM/dd" || formats[0] == "yyyy/MM/dd")) 
                return JalaliDate.parse(value);
        }
    }
    else {
        if (objectToString.call(value) === '[object Date]') {
            return value;
        }
    }
    var idx = 0;
    var date = null;
    var length;
    var tzoffset;
    if (value && value.indexOf('/D') === 0) {
        date = dateRegExp.exec(value);
        if (date) {
            date = date[1];
            tzoffset = offsetRegExp.exec(date.substring(1));
            date = new Date(parseInt(date, 10));
            if (tzoffset) {
                tzoffset = parseMicrosoftFormatOffset(tzoffset[0]);
                date = kendo.timezone.apply(date, 0);
                date = kendo.timezone.convert(date, 0, -1 * tzoffset);
            }
            return date;
        }
    }
    culture = kendo.getCulture(culture);
    if (!formats) {
        formats = getDefaultFormats(culture);
    }
    formats = isArray(formats) ? formats : [formats];
    length = formats.length;
    for (; idx < length; idx++) {
        date = parseExact(value, formats[idx], culture, strict);
        if (date) {
            return date;
        }
    }
    return date;
}


but this is for v2018 not working for v2021
Posted
Comments
4L4K1 5-Jun-22 20:18pm    
I had two problem in using persiandatetime
so I decide to ask them separately

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900