Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Date field format

eetied free asked 4 years ago


Hi,

I have problems with the 'input date field' combining with mdb.min.js. I don't know how to format the date after keyup, it always shows 'yyyy-mm-dd'. I already tried '.pickadate' or some other jquery modifications, but unfortunately, it always shows 'yyyy-mm-dd'. What am I doing wrong?

Expected behavior After I type 'dd-mm-yyyy', it stays to the format 'dd-mm-yyyy'.

Actual behavior After I type 'dd-mm-yyyy', it changed to 'yyyy-mm-dd', no matter what I do. Resources (screenshots, code snippets etc.)

<html>
<head>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="mdb.min.js"></script>
</head>
<body>

<div class="md-form">
  <input placeholder="Selected date" type="date" id="date-picker-example" class="form-control datepicker">
  <label for="date-picker-example">Try me...</label>
</div>


<script>
$(document).ready(function() {
    $('#date-picker-example').pickadate({
        format: 'dd-mm-yyyy',
        formatSubmit: 'dd-mm-yyyy'
    });


});

</script>
</body>
</html>

Mateusz Łubianka staff answered 4 years ago



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.15.0
  • Device: laptop
  • Browser: chrome
  • OS: windows 10
  • Provided sample code: No
  • Provided link: No