joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.76k stars 3.64k forks source link

Error in Joomla calendar #28698

Closed balvard closed 4 years ago

balvard commented 4 years ago

Steps to reproduce the issue

file : media/system/js/fields/calendar-locales/date/jalali/date-helper.js Error : This function not return requiredscreen shot 2020-04-17 at 08 00 42 data

Date.prototype.getLocalMonthDays = function(dateType, month) {
    if (dateType != 'gregorian') {
        /** Modify to match the current calendar when overriding **/
        var year = this.getLocalFullYear('jalali');
        if (typeof month == "undefined") {
            month = this.getLocalMonth('jalali');
        }
        if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
            return 29;
        } else {
            Date.local_MD[month]; <=== Error : Must be returned this value
        }
    } else {
        var year = this.getFullYear();
        if (typeof month == "undefined") {
            month = this.getMonth();
        }
        if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
            return 29;
        } else {
            return Date.gregorian_MD[month]; <==== Like this
        }
    }
};

Expected result

This is Expected

Date.prototype.getLocalMonthDays = function(dateType, month) {
    if (dateType != 'gregorian') {
        /** Modify to match the current calendar when overriding **/
        var year = this.getLocalFullYear('jalali');
        if (typeof month == "undefined") {
            month = this.getLocalMonth('jalali');
        }
        if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
            return 29;
        } else {
            return Date.local_MD[month];
        }
    } else {
        var year = this.getFullYear();
        if (typeof month == "undefined") {
            month = this.getMonth();
        }
        if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
            return 29;
        } else {
            return Date.gregorian_MD[month];
        }
    }
};

Actual result

System information (as much as possible)

Additional comments

balvard commented 4 years ago

And This function has same error Date.prototype.getMonthDays


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28698.

infograf768 commented 4 years ago

@balvard Could you please add screenshots of the Jalali results obtained in both cases, i.e. with return and without the return, for a said Gregorian date?

@dgrammatiko Any possible error here?

dgrammatiko commented 4 years ago

@balvard @infograf768 yes a return is required as correctly stated above.

infograf768 commented 4 years ago

OK. You make patch or I do?

brianteeman commented 4 years ago

(reset priority according to our defined criteria)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28698.

dgrammatiko commented 4 years ago

You make patch or I do?

If you're referring to me please do the PR (or maybe @balvard would like to do that)

infograf768 commented 4 years ago

will do as we also need a minified, but testing now differences first.

infograf768 commented 4 years ago

Please see patch https://github.com/joomla/joomla-cms/pull/28700

@balvard Please explain there the display differences with screenshots. Closing this as we have a patch.