I have the below function,which colors Title column in SP Online. I want to extract just the last 2 characters from "Period" and use it in the Switch case.
I tried Slice,Substr function but both didn't work. Can someone help me?
function PeriodView(ctx) {
var Period = ctx.CurrentItem["Title"];
switch (Period)
{
case "2017-09":
return '<b><u>' + Period + '</u></b>';
break;
case "2017-10":
return '<b><i>' + Period + '</i></b>';
break;
default:
return '<center>' + Period + '</center>';
break;
}
}