Avatar

Level 3

Very cool radzmar,

However, I was not clear on what was attempted, I am trying to get this to work:

var today = new Date();

var dd = today.getDate();

if (dd == 1) {

this.rawValue = dd + "st";

}

else if (dd == 2) {

this.rawValue = dd + "nd";

}

else if (dd == 3) {

this.rawValue = dd + "rd";

}

else if (dd >= 4) {

this.rawValue = dd + "th";

}

Trying to get the suffix to work in all scenarios. Tried this:

var today = new Date();

var dd = today.getDate();

if (dd == 1,21,31) {

this.rawValue = dd + "st";

}

else if (dd == 2,22) {

this.rawValue = dd + "nd";

}

else if (dd == 3,23) {

this.rawValue = dd + "rd";

}

else if (dd == 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,24,25,26,27,28,29,30) {

this.rawValue = dd + "th";

}