entering dates manually in persian calendar
We expect the entering manually date to be saved correctly like set by calendar popup
but after save it, in some months, one day will be added or one day will be reduced in set time
#16922(comment)
joomla 3.7.3
Labels |
Added:
?
|
Category | ⇒ | Administration |
Status | New | ⇒ | Information Required |
@infograf768 ok I am doing something stupid there, I try to parse the date but the date is not an object but rather a simple array of numbers :(
This should fix the Jalali calendar (around line 1014
// We need to transform the date for the data-alt-value
var mdate = new Date(), ndate, date = Date.parseFieldDate(calObj.inputField.value, calObj.params.dateFormat, calObj.params.dateType);
ndate = Date.localCalToGregorian(date.getFullYear(), date.getMonth(), date.getDate());
mdate.setFullYear(ndate[0]);
mdate.setDate(ndate[2]);
mdate.setMonth(ndate[1]);
calObj.inputField.setAttribute('data-alt-value', mdate.print(calObj.params.dateFormat, 'gregorian', false));
Let me know if this solves the problem
@infograf768 @dgt41
sorry but this change code in media/system/js/fields/calendar.js Has no effect on the problem (manually set persian date)
@farhadst strange, did you also applied #17183?
PS. I think there is a small bug in the above snippet, there shouldn't be a new mdate
variable, as that will reset the time to now, this should be the correct one:
// We need to transform the date for the data-alt-value
var ndate, date = Date.parseFieldDate(calObj.inputField.value, calObj.params.dateFormat, calObj.params.dateType);
ndate = Date.localCalToGregorian(date.getFullYear(), date.getMonth(), date.getDate());
date.setFullYear(ndate[0]);
date.setDate(ndate[2]);
date.setMonth(ndate[1]);
calObj.inputField.setAttribute('data-alt-value', date.print(calObj.params.dateFormat, 'gregorian', false));
But again this also requires #17183
@infograf768 yes debug is on
@dgt41 in media/system/js/fields/calendar.js line 1013 to 1026 is:
if (calObj.params.dateType !== 'gregorian') {
// We need to transform the date for the data-alt-value
var ndate, date = Date.parseFieldDate(calObj.inputField.value, calObj.params.dateFormat, calObj.params.dateType);
ndate = Date.localCalToGregorian(date.getFullYear(), date.getMonth(), date.getDate());
date.setFullYear(ndate[0]);
date.setDate(ndate[2]);
date.setMonth(ndate[1]);
calObj.inputField.setAttribute('data-alt-value', date.print(calObj.params.dateFormat, 'gregorian', false));
} else {
calObj.inputField.setAttribute('data-local-value', Date.parseFieldDate(calObj.inputField.value, calObj.params.dateFormat, calObj.params.dateType)
.print(calObj.params.dateFormat, 'gregorian', false));
calObj.inputField.setAttribute('data-alt-value', Date.parseFieldDate(calObj.inputField.value, calObj.params.dateFormat, calObj.params.dateType)
.print(calObj.params.dateFormat, 'gregorian', false));
}
but Has no effect on the problem
@dgt41 i check again and behaviour is the like befor:
If one of the January days is chosen according to Jalali, one day will be added to set date,
for example if set 1396-10-26 (16January) and save it, date change to 1396-10-27
any date In February, 1 day is added to the selected date
any date In March, 2 days from the chosen date will be reduced
for example if set 1396-12-24 (15March) and save it, date change to 1396-12-22
any date In April, no day can be chosen and if set any date, this change to the first of may
any date In may, 1 days from the chosen date will be reduced
There is no problem in June
any date In july, 1 days from the chosen date will be reduced
There is no problem in August and September
any date In October, 1 days from the chosen date will be reduced
any date In November, 1 day is added to the selected date
There is no problem in December
Please, look at this and post your comments there (concerns the calendar itself, not the field)
@infograf768 I check this and Yes, this problem was to persian calendar (day name incorrect)
with file replacement problem fixed and now day name is correct
Status | Information Required | ⇒ | Discussion |
What exactly is not working now?
Status | Discussion | ⇒ | Information Required |
@brianteeman I gave a full explanation on this post
any Opinion @brianteeman?
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-12-22 15:13:04 |
Closed_By | ⇒ | franz-wohlkoenig |
Closed_By | franz-wohlkoenig | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/17150
closed as stated above. Issue can always reopened.
@dgt41
Let's try again. Why would it work fine when using the popup and not when entering manually?