• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Console Error Not Function, But Similar Script runs ok in another dateobject field

Contributor ,
Mar 13, 2021 Mar 13, 2021

Copy link to clipboard

Copied

I have a series of three date object fields for business and for mobilehome: StartDate, EndDate, and AdvancedRenewalPeriodDate. The AdvancedRenewalPeriodDate calculates in days the difference between the EndDate field value minus 90 days. I took my scripts for these (business,mobilehome) AdvancedRenewalPeriodDate fields from the calculation script located in my original AdvancedRenewalPeriodDate used when BirthDate dateobject is involved. For some reason, my new ones (business,mobilehome) do not work. What am I missing???????  File Attached- Thanks in advance!!! 

 

//START DATE Registration Period for BUSINESS NOT FOR HIRE or

//SHORT TERM RENTAL JUN 01
var sACQb = this.getField("AcquiredDate").valueAsString;
if (sACQb == "") event.value = "";
else {
var dsACQb = util.scand("mm/dd/yyyy",sACQb);
dsACQb.setMonth(05);
dsACQb.setDate(01);
event.value = util.printd("mm/dd/yyyy", dsACQb);}

//END DATE Initial Registration Period for BUSINESS NOT FOR HIRE or

//SHORT TERM RENTAL MAY 31
var eACQb = this.getField("AcquiredDate").valueAsString;
if (eACQb == "") event.value = "";
else {
var deACQb = util.scand("mm/dd/yyyy",eACQb);
deACQb.setMonth(05);
deACQb.setDate(30);
event.value = util.printd("mm/dd/yyyy", deACQb);}

//businessADVANCEDRENEWALPERIODDATE BUSINESS NOT FOR HIRE or
//SHORT TERM RENTAL ENDDATE-90days
var bARP = this.getField("businessEndDate").valueAsString;
if (bARP == "") event.value = "";
else {
var dbARP = util.scand("mm/dd/yyyy", bARP);
dbARP.setDate(bARP.getDate()-90);
event.value = util.printd("mm/dd/yyyy", dbARP);}
______________________________________________________________________
//mobilehomeSTARTDATE JAN 1
var sACQmh = this.getField("AcquiredDate").valueAsString;
if (sACQmh == "") event.value = "";
else {
var dsACQmh = util.scand("mm/dd/yyyy",sACQmh);
dsACQmh.setMonth(00);
dsACQmh.setDate(01);
event.value = util.printd("mm/dd/yyyy", dsACQmh);}

//mobilehomeENDDATE DEC 31
var eACQmh = this.getField("AcquiredDate").valueAsString;
if (eACQmh == "") event.value = "";
else {
var deACQmh = util.scand("mm/dd/yyyy",eACQmh);
deACQmh.setMonth(11);
deACQmh.setDate(31);
event.value = util.printd("mm/dd/yyyy", deACQmh);}

//mobilehomeAdvancedRenewalPeriodDate ENDDATE-90days
var mhARP = this.getField("mobilehomeEndDate").valueAsString;
if (mhARP == "") event.value = "";
else {
var dmhARP = util.scand("mm/dd/yyyy", mhARP);
dmhARP.setDate(mhARP.getDate() - 90);
event.value = util.printd("mm/dd/yyyy", dmhARP);}

TOPICS
How to , JavaScript

Views

401

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 13, 2021 Mar 13, 2021

You can't use

bARP.getDate()

bARP is a string. The function getDate() is not available for strings.

dbARP is a date object.

Votes

Translate

Translate
Community Expert ,
Mar 13, 2021 Mar 13, 2021

Copy link to clipboard

Copied

bARP is a string, not a Date object.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 13, 2021 Mar 13, 2021

Copy link to clipboard

Copied

I do not follow. I thought the util.scand interpreted the variable into date format chosen?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2021 Mar 13, 2021

Copy link to clipboard

Copied

LATEST

You can't use

bARP.getDate()

bARP is a string. The function getDate() is not available for strings.

dbARP is a date object.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines