Recent

Custom Controls Using Angular Material

Git Repo:  https://github.com/yawahang/ohcontrols Features DatePicker (Date Picker, Time Picker, Date Time Picker, and many more) RatingPicker (Vertical, Horizontal, Custom Icons) Select (Single Select, MultiSelect, Single Column, MultiColumn) Recursive Treeview

Validate StartTime before current time using moment.js

function checkTime(Time) {

  var currentTime = moment().format('HH:mma');
  currentTime = convert24To12(currentTime);

  currentTime = moment(currentTime"HH:mma");
  Time = moment(Time"HH:mma");

  var $res = currentTime.isBefore(Time);

  if (!$res) {
    return "StartTime time should be after current time !";
  }
  else {
    return "";
  }
}

function convert24To12(timeString) {

  var H = +timeString.substr(02);
  var h = (H % 12) || 12;
  var ampm = H < 12 ? " AM" : " PM";
  timeString = h + timeString.substr(23) + ampm;

  return timeString;
}

Comments

Top Posts

SQL Server Symmetric Key & Certificate based Encryption With AES_256 Algorithm

Kendo Grid Angular Column Width, minResizableWidth dynamic

Kendo Grid AutoFit Columns