asked on October 1, 2018 Show version history

I am creating a time card form for a client that wants to not only calculate time in - time out and have the sum show up in the table and outside the table but also wants it in 15min increments. I have the calculations working so far with the hours but not the minutes. I tried adding the toFixed(2) command to various parts of my code but to avail. anyone have an Idea where I can make the calculations show up as decimals?

 

$(document).ready(function () {
  $('.table').on('blur','input',function () {
    $('.table tr').each(function () {
      var minuend = parseNumber($(this).find('.minuend input').val());
      var subtrahend = parseNumber($(this).find('.subtrahend input').val());
      var difference = minuend - subtrahend;
      $(this).find('.difference input').val(difference).trigger('change');
    });
  });
});

function parseNumber(n) {
  if (isNaN(parseInt(n))) {
    var f = 0;
  } else {
    var f = parseFloat(n.replace(/\,/g,'')); //Convert to float number.
  }
  return isNaN(f) ? 0 : f; //treat invalid input as 0;
}

$(document).ready(function () {
    $.getScript('https://lf.on-sitesvcs.com/forms/js/jquery.timepicker.min.js', function() {
       $('.cf-table-add-row').click(function () {
      $('.meeting input').timepicker({ 'step': 15, timeFormat: 'H:i:s', 'scrollDefault': 'now' });
    });
});
 

0 0