Skip to main content
1 of 4

magento 2 custom calendar instead of core magento calendar

I want to create jalaali calendar (persian calendar) instead of magento core calendar for admin and front pages .

for this purpose I've added this line to my requirejs-config in my module :

   'map': {
       '*': {
          'mage/calendar' : 'MyNamespace_MyModule/js/persian_calendar'
        }
    }

persian date and gregorian date are completely different and they have different years , months and days name . I want to show persian date to user but save date as gregorian format to database .

my idea for sending date to server and saving it to database is :

in my custom calendar.js when user select a date on calendar , persian date is showing to user at same time I put equivalent gregorian date in hidden field with same input name , finally I change the name of the previous field to something to have only one unique input name

by these my calendar showing correctly to user and equivalent gregorian date putting in hidden field correctly .

but when I send data form to server invalid date with incorrect value will send to server and magento ignores my hidden field .

I don't know where magento check input date and change it to incorrect value .

Does anybody know where magento check date inputes and changing them ? Or Does anyone have a completely different idea for this purpose ?