PDA

View Full Version : Check if this is the current month



Dannesart
15 Nov 2011, 12:08 AM
Hi I got a grid with data and a month/year picker so I can change month/year.
I want to check if this is the current month. If it is then I want to show warning icon like in the pictre
29287

Else it shouldn't appear any warning icon.

My code:

var checkMonth = new Date();
var month = checkMonth.getMonth();
if (!month) {
return employmentPeriod;
}
else {

if (record.get('employementEndSoon')) {
var dagensdatum = new Date();
var firstDate = record.get('employeeFirstDate');
var slutdatum = record.get('employeeEndDate');

var grejs = slutdatum.getDate();
var mojs = dagensdatum.getDate();
if (grejs > mojs) {
var random = grejs - mojs;
}
else {

var random = grejs - mojs + 31;
}
// var dag = dagarkvar.getDate();

metaData.tdAttr = Intelliplan.Util.Qtip.createAttrString(


random + ' ' + 'dagar kvar tills anställningsperioden tar ****'

// IPtranslate('Intelliplan.Common.Grid.EmploymentPeriodColumn.EmploymentEndSoonTooltip')
);


return Intelliplan.Common.General.GridTemplates.warningColumnWithValueToLeft.applyTemplate({value: employmentPeriod});

}
}

Any idea?

mitchellsimoens
16 Nov 2011, 12:50 PM
Do you want to do this in the XTemplate or in the JS code?