Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

174
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda