i am using this blow code for laravel i want to date format , 12/12/2019 To 12-12-2019
code
<script>
function DDMMYYYY(value, event) {
let newValue = value.replace(/[^0-9]/g, '').replace(/(\..*)\./g, '$1');
const dayOrMonth = (index) => index % 2 === 1 && index < 4;
// on delete key.
if (!event.data) {
return value;
}
return newValue.split('').map((v, i) => dayOrMonth(i) ? v + '/' : v).join('');;
}
</script>
input
<div class="col-md-4">
<input type="tel" maxlength="10" placeholder="DD/MM/YYYY"
oninput="this.value = DDMMYYYY(this.value, event)" required class="form-control " name="certificate_issue_date" id="certificate_issue_date">
</div>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire