creativetimofficial / argon-dashboard

Argon - Dashboard for Bootstrap 5 by Creative Tim
https://www.creative-tim.com/product/argon-dashboard
MIT License
674 stars 1.26k forks source link

Change datepicker format to dd/mm/yyyy #25

Closed SondayAyoub closed 4 years ago

SondayAyoub commented 5 years ago

I want to change the datepicker input to return the date value in this format: dd/mm/yyyy

PS: I'm using the range option!

rarestoma commented 5 years ago

Hello,

Thank you for working with our products.

Please check the official documentation of datepicker https://bootstrap-datepicker.readthedocs.io/en/latest/.

All the best, Rares

WilliamWalker commented 4 years ago

I had the same desire. I chose to replace the argon-dashboard class with one of my own, and then use the (modified argon-dashboard.js) function below:

var Datepicker = (function() {
      // Variables
      var $datepicker = $('.datepicker-yyyymmdd');

      // Methods
      function init($this) {
        var options = {
          disableTouchKeyboard: true,
          autoclose: true,
          format: "yyyy-mm-dd"
        };
        $this.datepicker(options);
      }

      // Events
      if ($datepicker.length) {
        $datepicker.each(function() {
          init($(this));
        });
      }
    })();
rarestoma commented 4 years ago

Hi,

I see that now in your js the format is different from dd/mm/yyyy. Did you try with format: 'mm/dd/yyyy'?

All the best, Rares