joomla / joomla-cms

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

date of article broken in persian language by update to 3.4.2 #7298

Closed farhadst closed 9 years ago

farhadst commented 9 years ago

update joomla 3.4.1 to 3.4.2 when edit article, date is broken like #6207 actual problem in joomla 3.4 is back in 3.4.2 in old version after click on save article, jalali date convert to gregorian before submit form but in 3.4.2 date is not converted! 57264512-be72-11e4-8e11-2416745b0f43 @dgt41

infograf768 commented 9 years ago

Confirmed...

dgrammatiko commented 9 years ago

Is there a JS error logged?

infograf768 commented 9 years ago

@dgt41 I suggest you test for yourself as there are many errors

farhadst commented 9 years ago

@dgt41 It seems js file not loaded to be convert date and when save article, get error in line 108 of mootools-core.js in firebug console! please test yourself

mamool commented 9 years ago

This error happened when update "core.js" in joomla 3.4.2

infograf768 commented 9 years ago

Jalali calendar js ARE loaded OK:

<script src="/trunkgitnew/media/fa-IR/js/calendar.js" type="text/javascript"></script>
  <script src="/trunkgitnew/media/fa-IR/js/calendar-setup.js" type="text/javascript"></script>

The issue looks indeed related to core.js and started with this commit https://github.com/joomla/joomla-cms/commit/de492a6ce137286b7917bb5cd9200ea12406acaa ( https://github.com/joomla/joomla-cms/pull/6587 )

Fedik commented 9 years ago

seems calendar-setup-uncompressed.js has wrong event binding,

work:

jQuery(document).ready(function() {
        jQuery(C.inputField.form).on('submit', function() {
            var dateEl = C.inputField || C.displayArea;
            var dateFmt = C.inputField ? C.ifFormat : C.daFormat;
            if (dateEl && parseInt(dateEl.value) != 0 && dateEl.value != '') {
                var date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt, 'jalali');
                C.inputField.value = date.print(C.ifFormat, 'gregorian', C.langNumbers);
            }
        });
});

not work:

jQuery(document).ready(function() {
        jQuery.fn.addEvent = jQuery.fn.bind;

        C.inputField.form.addEvent('onsubmit', function() {
            var dateEl = C.inputField || C.displayArea;
            var dateFmt = C.inputField ? C.ifFormat : C.daFormat;
            if (dateEl && parseInt(dateEl.value) != 0 && dateEl.value != '') {
                var date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt, 'jalali');
                C.inputField.value = date.print(C.ifFormat, 'gregorian', C.langNumbers);
            }
        });
});

but, I did not tested it well, as I do not know Persian and all aspects of this language, so cannot be sure for 100%

farhadst commented 9 years ago

@fedik i did tested this code and not work

Fedik commented 9 years ago

for test calendar-setup-uncompressed.js need to enable the Debug in global config, hope you did it? :wink:

infograf768 commented 9 years ago

I tested it and it works here: Exchange these files in media/fa-IR/js/ to use these. https://www.dropbox.com/s/z4sq61515q8svyf/calendar-setup-uncompressed.js?dl=0 https://www.dropbox.com/s/wckglyo78qp7dot/calendar-setup.js?dl=0

One should know that when closing or saving the calendar field switches to gregorian for a second.

farhadst commented 9 years ago

@fedik you right, after enable debug its work :) @infograf768 i have replace this files and its work calendar after save converted fine Thanks

zero-24 commented 9 years ago

Thanks for the feedback I'm going to close here :smile:

cyrezdev commented 9 years ago

@infograf768 Yes, with your fa-IR js it works. As it is a language pack issue, maybe right to inform the translation team to release a 3.4.2 version of the Persian language with the correct js files ?


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

Bakual commented 9 years ago

As it is a language pack issue, maybe right to inform the translation team to release a 3.4.2 version of the Persian language with the correct js files ?

Exactly

dgrammatiko commented 9 years ago

Just to mention that this is a bad communication problem here, as we already stated that the language files should be updated with the correct code for 3.4.2 https://github.com/joomla/joomla-cms/issues/6207#issuecomment-91833886

farhadst commented 9 years ago

@balvard please replace correct code and release new persian language pack and i have email correct code to persian language team

infograf768 commented 9 years ago

The TT coordination has sent a mail too to the fa-IR Coordinator.

cyrezdev commented 9 years ago

Just a question : is there someone working on a new calendar datetime picker ? In my opinion, Jalali calendar should be managed by Joomla core, not a language pack. (I know it's a hard work to manage, so that's why i wonder if someone already started to work on this ;-) )

infograf768 commented 9 years ago

Many people tried, without success until now.

Fedik commented 9 years ago

@JoomliC I guess no one :smile: but this https://github.com/dbushell/Pikaday + this http://momentjs.com/ looks not bad, only problem that Pikaday does not support the time

cyrezdev commented 9 years ago

@infograf768 i've worked all June to make my calendar module working with Jalali calendar, and yes, it is a challenge to do this! @Fedik Thanks for link, but seems not to take care of jalali calendar (only Gregorian) or i'm wrong... In all cases, my idea is a calendar picker with multiple options : date, time, year, month... (at choice from the field). Could be useful to have only a time picker or a year picker if you dont need the full calendar. At least, a time selector would be useful (which one is already in the current code, but not active). ;-)

Fedik commented 9 years ago

@JoomliC internationalisation by http://momentjs.com/ , but to be honest I do not know what there displaied on demo page :smile: :

screen 2015-07-02 16 31 01 843x825

cyrezdev commented 9 years ago

Yes for translation, but don't convert the display to Jalali calendar... So, this one bootstrap script using moment.js : https://eonasdan.github.io/bootstrap-datetimepicker/ seems nice, but don't think it does it too... Don't know if exists one datetime picker saving input in SQL date, but displaying in culture calendar...

minijoomla commented 9 years ago

@infograf768 I added jalali date & hijri date to jquery ui datepicker before. check this https://github.com/mhehm/jquery-ui/commit/3aede66e9c60d13de2089b0af911a2dd9bb20991

https://github.com/jquery/jquery-ui/pull/986

minijoomla commented 9 years ago

check this http://keith-wood.name/calendarsPicker.html A jQuery plugin that provides a datepicker with support for various world calendars.

cyrezdev commented 9 years ago
check this http://keith-wood.name/calendarsPicker.html A jQuery plugin that provides a datepicker with support for various world calendars.

Thanks, i've tested it online already, but it seems that this one set locale on header, so may not be the best behavior to integrate into Joomla CMS... In all cases, thank you for all the links!

Do you know what's new about jquery-ui globalize ? (https://github.com/jquery/jquery-ui/pull/986)

minijoomla commented 9 years ago

http://wiki.jqueryui.com/w/page/12137778/Datepicker

infograf768 commented 9 years ago

The new fa-IR pack for 3.4.3 now includes the new js files.

saeedsol1 commented 9 years ago

3.4.3 have bug After update new pack fa-IR 3.4.3 in rsform thank you editing not saved

infograf768 commented 9 years ago

I guess rsform needs also an update. You should contact the developer as it is a commercial extension.

majidmahdavi commented 9 years ago

special thanks to all of you for helping out.

after updating joomla to 3.4.3 and fa-IR language pack to 3.4.3v2 (the latest one you have mentioned) whole problem in Article solved, but in K2 Items there is still a bug:

on Adding new Item (When no date chosen yet), date printed in HTML source in Jalali format , so the datetime picker try to convert it again to Jalali and result will be so wrong date.

the only thing that working right, is on submitting form ( when i choose correct date by picker) and save the form, before saving, date converted to Georgian, but again when form loaded, it has printed Jalali date in HTML and again like new state

summary: everything is fine when submitting form but when form loaded ( adding new item, or editing item) it shows jalali date in HTML

solve proposal: Date have to be printed in Georgian in Date input HTML and have to be converted to jalali in run time

my question: how to stop k2 to not convert date in jalali in HTML Source?

majidmahdavi commented 9 years ago

excuse me, i wasn't so familiar with rules in here, i opened an issue in K2 https://github.com/joomlaworks/k2/issues/247

majidmahdavi commented 9 years ago

i got the answer by myself.

i clearly found out, date in joomla forms (that are related to database) have to be in Georgian format, and never have to be converted to user language in html source, just manipulating it by javascript in runtime for viewing!

farazwebman commented 9 years ago

I upgrade my joomla to 3.4.4 and install v3.4.4 v2 persian lang pack but i have a problem with creation date after update !!!!

infograf768 commented 9 years ago

@farazwebman Can you explain which problem you have and with which browser? For me it is working fine.

screen shot 2015-10-12 at 12 42 18

farazwebman commented 9 years ago

@infograf768 after publish when I want to update an article after save create time change to 777/../.. for every time I press save button create time has change ..... bud update time is correct ! after save if you change administrator lang to EN time change to 1394 (it must be 2015) firefox 41.0.1

infograf768 commented 9 years ago

If it works for Update date but not for Create date, it looks unrelated to the Persian pack Jalali calendar. Please post in the Persian forum http://forum.joomla.org/viewforum.php?f=102

dgrammatiko commented 9 years ago

@farazwebman do you get any console errors?

infograf768 commented 9 years ago

@dgt41 the persian 3.4.4.2 lang pack calendar contains the changes from https://github.com/joomla/joomla-cms/pull/7643