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
Hi @eetied,
I created a snippet with an example: https://mdbootstrap.com/snippets/jquery/mateusz-lubianka/1926627
Best,
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- 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