Level 122
Those input fields will be returned as strings, but you are trying to do math on them
You need to parse them with something like moment.js so that you can then do the math operations
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to date difference between using datetimepicker not datepicker .how cant i get and i try but it's show " NaN " . below my javascript
$('#myModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget)
var fromDate = button.data('fromdate')
var toDate = button.data('todate')
var from = $('#fromDate').val();
var to = $('#toDate').val();
var diff = Date(to - from);
var days = diff/1000/60/60/24;
console.log(days)
)};
Please or to participate in this conversation.