Javascript dates have always been a pain for me. I finally figured it out so I wanted to share. There is a video plus the code. Happy Labor Day!
http://www.screencast.com/t/LhblxFXJ
'onDialogInitialize
e.control.DateRBeg = Date_FirstDayOfPreviousMonth()
e.control.DateREnd = Date_LastDayOfPreviousMonth()
//Minus Button:
var vd = {dialog.Object}.getValue('DateRBeg');
var d1 = new Date(vd);
var d2 = new Date(vd);
d1.setMonth(d1.getMonth()-1,1);
d2.setMonth(d2.getMonth(),0);
var vs = d1.toFormat('MM/dd/yyyy');
var ve = d2.toFormat('MM/dd/yyyy');
{dialog.Object}.setValue('DateRBeg',vs);
{dialog.Object}.setValue('DateREnd',ve);
//{dialog.object}.buttonClick('B_FILTER');
//Plus Button
var vd = {dialog.Object}.getValue('DateRBeg');
var d1 = new Date(vd);
var d2 = new Date(vd);
d1.setMonth(d1.getMonth()+1,1);
d2.setMonth(d2.getMonth()+2,0);
var vs = d1.toFormat('MM/dd/yyyy');
var ve = d2.toFormat('MM/dd/yyyy');
{dialog.Object}.setValue('DateRBeg',vs);
{dialog.Object}.setValue('DateREnd',ve);
//{dialog.object}.buttonClick('B_FILTER');
//Filter Button:
var vSDate = {dialog.Object}.getValue('DateRBeg');
var vEDate = {dialog.Object}.getValue('DateREnd');
var vparams = vSDate + '|||D|whatSDate\n' + vEDate + '|||D|whatEDate';
{dialog.object}._filterList('ListOfBills','DateBeg between :whatSDate AND :whatEDate','',vparams);
http://www.screencast.com/t/LhblxFXJ
'onDialogInitialize
e.control.DateRBeg = Date_FirstDayOfPreviousMonth()
e.control.DateREnd = Date_LastDayOfPreviousMonth()
//Minus Button:
var vd = {dialog.Object}.getValue('DateRBeg');
var d1 = new Date(vd);
var d2 = new Date(vd);
d1.setMonth(d1.getMonth()-1,1);
d2.setMonth(d2.getMonth(),0);
var vs = d1.toFormat('MM/dd/yyyy');
var ve = d2.toFormat('MM/dd/yyyy');
{dialog.Object}.setValue('DateRBeg',vs);
{dialog.Object}.setValue('DateREnd',ve);
//{dialog.object}.buttonClick('B_FILTER');
//Plus Button
var vd = {dialog.Object}.getValue('DateRBeg');
var d1 = new Date(vd);
var d2 = new Date(vd);
d1.setMonth(d1.getMonth()+1,1);
d2.setMonth(d2.getMonth()+2,0);
var vs = d1.toFormat('MM/dd/yyyy');
var ve = d2.toFormat('MM/dd/yyyy');
{dialog.Object}.setValue('DateRBeg',vs);
{dialog.Object}.setValue('DateREnd',ve);
//{dialog.object}.buttonClick('B_FILTER');
//Filter Button:
var vSDate = {dialog.Object}.getValue('DateRBeg');
var vEDate = {dialog.Object}.getValue('DateREnd');
var vparams = vSDate + '|||D|whatSDate\n' + vEDate + '|||D|whatEDate';
{dialog.object}._filterList('ListOfBills','DateBeg between :whatSDate AND :whatEDate','',vparams);
Comment