Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Dates


Thread Tools Search this Thread Display Modes
Old August 9th, 2018, 02:06 PM
iprint2 iprint2 is offline
Junior Community Member
Join Date: Apr 2014
Posts: 30
Default Date Rule to return Graphic not working

Below is the rule that I am working with

if (FormatDate(Field("BIRTH_DATE"),"mm/dd/yyyy") > FormatDate("08/31/1963","mm/dd/yyyy"))
return Resource("Entertainment TL_Sept.jpg");
return Resource("Better with Age Day_new TL_Sept.jpg");

My problem is that I have the date of 10/08/1942 and it is returning the Entertainment graphic rather than the Better with Age Day and I have a 05/15/1976 that is doing the opposite. Other dates are working fine. Any idea what I am doing wrong?
Fusion Pro VDP Creator 9.3.22
Acrobat 11.0.10 and DC

Mac OS 10.10
Reply With Quote
Old August 10th, 2018, 08:24 AM
step's Avatar
step step is offline
Senior Contributor
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: Date Rule to return Graphic not working

You're comparing strings rather than dates. You should convert them to actual dates:
var birthday = new Date(Field('BIRTH_DATE'));
var cutoff = new Date('08/31/1963');
var file = birthday > cutoff ? 'Entertainment' : 'Better with Age Day_new';
return Resource(file + ' TL_Sept.jpg');
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 03:19 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.