I have a string in JavaScript like #box2
and I just want the 2
from it.
I tried:
var thestring = $(this).attr(\'href\');
var
changeStrangeDate(dateString: string) {
var sum = 0;
var numbers = dateString.match(/\d+/g);
if (numbers.length > 1) {
numbers.forEach(element => {
sum += parseInt(element);
}
);
}
console.log(new Date(sum).toDateString());
return new Date(sum).toUTCString();
}
You can do it like that and then call function where you need, with parameter.
this.changeStrangeDate('/Date(1551401820000-0100)/');