Home javascript Bootstrap DateTimepicker on WP

Bootstrap DateTimepicker on WP

Author

Date

Category

// init datelightpickers
    if ($ ('. WPES-DATEPICKER'). Length & gt; 0) {
      $ ('. WPES-DATEPICKER'). Each (Function () {
        Locale: 'RU'
        var dateformat = 'dd-mm-yyyy';
        If ($ (this) .attr ('Date-Format')) {
          DateFormat = $ (this) .attr ('Date-Format');
        }
        $ (this) .dateTimepicker ({
          Format: DateFormat,
          USECURRENT: FALSE,
          icons: {
            Time: "FA FA-CLOCK-O",
            Date: "FA FA-Calendar",
            Up: "FA FA-Chevron-Up",
            DOWN: "FA FA-Chevron-Down",
            Previous: 'FA FA-Chevron-left',
            Next: 'FA FA-Chevron-Right',
            Today: 'FA FA-Screenshot',
            Clear: 'FA FA-TRASH',
            Close: 'FA FA-REMOVE'
          }
        });
      });
    }

code in the template on WordPress, calendar in English, how to make in Russian?


Answer 1

After the line

$ (this) .dateTimepicker ({

Add

Language: 'RU',


Answer 2

You can use the following code:

$. datetimepicker.setlocale ('RU');

Example:

var localecode = "ru";
$ .dateTimepicker.Setlocale (Localecode);
Var StartDate = $ ('# startdate');
VAR EndDate = $ ('# EndDate');
startdate.datetimepicker ({
  Timepicker: False,
  Format: 'Y-M-D',
  Formatdate: 'Y-M-D',
  OnShow: Function (CT) {
    this.setoptions ({
      MaxDate: enddate.val ()? enddate.val (): false
    })
  }
});
enddate.datetimepicker ({
  Timepicker: False,
  Format: 'Y-M-D',
  Formatdate: 'Y-M-D',
  OnShow: Function (CT) {
    this.setoptions ({
      MINDATE: startdate.val ()? startdate.val (): false
    })
  }
});
Var StartTime = $ ('# starttime');
var endtime = $ ('# EndTime');
starttime.datetimepicker ({
  DATEPICKER: FALSE,
  Format: 'H: I',
  OnShow: Function (CT) {
    this.setoptions ({
      MAXTIME: endtime.val ()? endtime.val (): false
    })
  }
});
endtime.dateTimepicker ({
  DATEPICKER: FALSE,
  Format: 'H: I',
  OnShow: Function (CT) {
    this.setoptions ({
      Mintime: starttime.val ()? starttime.val (): false
    })
  }
});

Answer 3

Solution found in the bootstrap-datetimepicker.min.js file

There hands edited lines:

ht = "Sunday_Pront_Teter_Subbote" .Split ("_"), LT = "VSK_PND_VTR_SERTV_PTN_Sub" .split ("_" ), Gt = "sun_pn_vt_sp_cht_pt_sb"

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions