How to check the date is within 3 months of the current date?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2015 11:11 PM
I need to check the date is within 3 months of the current date. I checked it by 90 days but the requirement is for 3 months. I need to check date within 3 months. means its may be either 90 days or 92 days. kindly help me into this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2015 06:15 AM
My code is given below,
var date1 = g_form.getValue('valid_to');//client script
var date2=gs.monthsAgo(-3); //script include
if(date1<date2)
{
alert(date2);
}
my If condition is not executing when I take date1 value "oct-31-2015."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2015 06:42 AM
Thats why I also suggested current.sys_created_on>gs.monthsAgo(3)
However, you could do this client side only:
Something like this:
var threeMonthsAgo = new Date();
threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);
var validTo = new Date(g_form.getValue("valid_to"));
var isValid = ( validTo > threeMonthsAgo ); //true / false
console.log(isValid);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2015 07:15 AM
Hi Dan,
my valid_to field is already glidedate type. when I convert it to date it throwing invalid date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2015 08:27 AM
I'm not sure I understand the difference between "90 days" and "3 months ago". Are you saying the requirement is to check against the date of the month but three months ago, regardless how many days that was? So today you would be checking against July 5th? How does that work on July 31st when there is no valid date for three months prior?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2015 10:59 PM
I need to convert a string "mon-dd-yyyy" in glideDate.