How to set 1st as starting date of a Month & 30 as End date

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
fody26
Posts: 1
Joined: Tue Dec 05, 2017 11:08 am

How to set 1st as starting date of a Month & 30 as End date

Post by fody26 » Tue Dec 05, 2017 11:24 am

Hi,

I am currently working on a code that requires the start date to have the first date of the present month and the end date to be exactly one year from the start date. (Format below)

Dates (YYYY-MM-DD) should be:
Start date: 2017-11-01
End date: 2018-10-31 OR

Start date: 2017-12-01
End date: 2018-11-30 OR


'Date Range
EVENT TYPE=CLICK SELECTOR="#dateRange" BUTTON=0

'START DATE
'TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:daterangepicker_start CONTENT=EVAL("var today = new Date(); var nextyear = new Date(); nextyear.setDate(today.getDate() + 0); var day = nextyear.getDate().toString(); if (day.length < 2) {day = \"0\" + day;} var month = (nextyear.getMonth() - 1).toString(); if (month.length < 2) {month = \"0\" + month;} var year = nextyear.getFullYear().toString(); year+month+day;")

'END DATE
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:daterangepicker_end CONTENT=TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:daterangepicker_end CONTENT=EVAL("var today = new Date(); var nextyear = new Date(); nextyear.setDate(today.getDate() + 30); var day = nextyear.getDate().toString(); if (day.length < 2) {day = \"0\" + day;} var month = (nextyear.getMonth() + 12).toString(); if (month.length < 2) {month = \"0\" + month;} var year = nextyear.getFullYear().toString(); year+month+day;")

TAG POS=1 TYPE=BUTTON ATTR=TXT:Apply

Any help on this would be greatly appreciated

Thanks
Post Reply