return date.toLocaleDateString('en-GB').replace(/\//g, '-'); */
const date = dateVal instanceof Date ? dateVal : new Date(dateVal);
return date.toLocaleDateString('en-GB').replace(/\//g, '-');
private convertToLocalDateFormatted(inputDate: string): any {
if (this.dashedDateString(inputDate)) {
const parts = inputDate.split('-'); // parts[0] = day, parts[1] = month, parts[2] = year
const dateObj = new Date(Date.UTC(parseInt(parts[2]), parseInt(parts[1]) - 1, parseInt(parts[0])));
const year = dateObj.getFullYear();
const month = dateObj.getMonth() + 1;
const day = dateObj.getDate();
const formattedMonth = month < 10 ? `0${month}` : `${month}`;
const formattedDay = day < 10 ? `0${day}` : `${day}`;
return new Date(`${year}-${formattedMonth}-${formattedDay}`); // YYYY-MM-DD obj
}
return inputDate;
}
private convertDate(dateBegin, dateEnd) {
const firstDate = new Date(dateBegin);
const secondDate = new Date(dateEnd);
firstDate.setHours(0, 0, 0, 0);
secondDate.setHours(0, 0, 0, 0);
return [firstDate, secondDate]
}
const isModelChanged = [
approvalDate,
approvalExpiryDate,
selectedApproverType,
selectedApproverSubtype,
selectedApproverFor,
selectedApprover,
selectedStatus,
];
return isModelChanged.some(item => item !== undefined);
const filtered = this.allsubtypes.filter(item => item["code"] === subtype);
return filtered.length > 0 ? filtered[this.falseIdx]["description"] : null;
this.allsubtypes = availableTypes.reduce((acc, el) => acc.concat(el), []);
const data = Object.keys(response).map((key) => (response[key].data))
(window.location.hash) ? {} : {}
List of all on events
onClick
onContextMenu
onDoubleClick
onDrag
onDragEnd
onDragEnter
onDragExit
onDragLeave
onDragOver
onDragStart
onDrop
onMouseDown
onMouseEnter
onMouseLeave
onMouseMove
onMouseOut
onMouseOver
onMouseUp
var newArr = arr.map(function(obj) {
return obj.dateVal;
});
var arr = [false, true];
//method 1
Array.prototype.sample = function(){
return this[Math.floor(Math.random()*this.length)];
}
var isTrue = arr.sample();
//method2
var rand = arr[(Math.random() * arr.length) | 0];
addCocs.sort(function (a, b) { return a.docName- b.docName});
this.setTextAreaAutosize = function() {
var txtArea = 'textarea-textarea-IDField:Text_Area1';
var s_height = document.getElementById(txtArea).scrollHeight + 20;
if (!!s_height) {
document.getElementById(txtArea).setAttribute('style', 'height:' + s_height + 'px');
}
}
function isNotDefined(value) {
return typeof value === "undefined";
}
var resp = needToFilter.filter(function (oldg) {
return oldg.isSend === true && oldg.phone === tw.local.smsRequestList[i].CountryCode && oldg.no === tw.local.smsRequestList[i].PhoneNo
});
var start = new Date('10/3/2015');
var end = new Date('11/2/2015');
var days = (end - start) / 1000 / 60 / 60 / 24;
// actually its 30 ; but due to daylight savings will show 31.0xxx
// which you need to offset as below
days = days - (end.getTimezoneOffset() - start.getTimezoneOffset()) / (60 * 24);
console.log(days);
/*
-------------------- output ----------------------------
30.041666666666668
30
*/
var date1woH = new Date(loanNumbersSorted[i].disbursementDate).setHours(0, 0, 0, 0);
var date2woH = new Date(loanNumbersSorted[i - 1].disbursementDate).setHours(0, 0, 0, 0);