Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
Using Jalali DatePicker but only use Gregorian Value


First of all, I'm noob :) I'm trying to replace a CodeIgniter application DateTimePicker with another library called "Persian Datepicker" (https://babakhani.github.io/PersianWebToolkit/doc/datepicker).
1. On the first try, I tried altField option:
I created another input with "Persian Datepicker" that filled the original value automatically with the converted format (using Jalali Moment). Everything works fine, Original input value format is correct, but somehow the value didn't save at all; It works Only when the original input is modified by the user.

$('#duedate.jdatepicker').persianDatepicker({
        format: "YYYY/MM/DD",
        initialValue: false,
        calendarType: "persian",
        observer: true,
        responsive: true,
        calendar: {
         persian: {
               locale: "en",
         }
        },
        onSelect: function() {
         var dataDue = $('#jalali_due.pdatepicker').val();
         var dueConv = moment.from(dataDue, 'fa', 'YYYY/MM/DD').format('YYYY-MM-DD');
         $('.altDue').val(dueConv);
        }
    });
  1. After I failed with that, I tried to completely replace the already existed DateTimePicker, with "Persian Datepicker". In this case, Jalali should be converted to Gregorian date right after the user selects it because the application only uses the Gregorian format. I couldn't do this either :( I tried the code below...
$('#startdate.jdatepicker').persianDatepicker({
        format: "YYYY/MM/DD",
        initialValue: false,
        calendarType: "persian",
        observer: true,
        responsive: true,
        calendar: {
         persian: {
               locale: "en",
         }
        },
        onSelect: function(year) {
         var self = this;
         var startData = self.calendar;
         if (startData = "persian") {
         $('#startdate.jdatepicker').val('/**Gregorian Format**/')
       } else {
         $('#startdate.jdatepicker').val('/**Gregorian Format**/')
       }
         
        }
    });

Please help me out with this; Also if there's a better solution, let me know.

The application uses https://xdsoft.net/jqplugins/datetimepicker/ for DateTime Picker

Regards,

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!