Time Period - Date Calculations
Hey All,
We rent out property and I am trying to create a calculation from when the tenants move in plus X months.
Example: Tenant moves in on the 1st June and will stay with us for 15 months = Calculation 1st June + 15 months.
I would also like to do this for our mortgage periods.
Example: New mortgage starts on the 1st June and we have a 20 month fixed term period = Calculation 1st June + 20 months.
Anyone recommend an easy way to do this?
(Rather then using start and end dates and adding them manually)
Thanks for your help with this item.
Rgds,
Warren
-
Hi Warren,
assuming you have these 2 fields:
Date field (move in date)
Number field (number of month)
you get the end date in the calculation field with this:moment(@date field).add(@number field,"months").toDate()
For the mortgage period: If the period is always fixed to 20 months:
moment(@date field).add(20,"month").toDate()
Rainer
-
hello, i have a help desk application under podio and i included a field to calculate the number of tickets issued like this: @All of Ticket Number.length
i have a different field with the date the customer agreement ends and i want to include the javascript in order for me to receive only the tickets issued from the ending date and a year back, please help me to define the java script
Each customer agrrement is valid for one year so i want to have the tickets issued under this period
-
Hello Raul,
this should work:
var start = moment(@date agreement ends).subtract(1,"year").unix();
var ticketDates = @All of Ticket Date;
var sum = 0;
for(var i = 0; i < ticketDates.length; i++){
if(moment(ticketDates[i]).unix() >= start){
sum +=1;
}
};
sumThat returns the number of tickets since Agreement end date minus 1 year.
Rainer
-
thanks Rainer, i wrote down: var start = moment(@Deadline).subtract(1,"year").unix();
var ticketDates = @All of Ticket Number.length;
var sum = 0;
for(var i = 0; i < ticketDates.length; i++){
if(moment(ticketDates[i]).unix() >= start){
sum +=1;
}
};but it only returns 1
i change @all of tickets date for ,@all of ticket number.length due to it adds all the tickets numbers, is this correct?
-
My code compares the start date with a date field in the tickets, .unix() returns the timestamp of that date.
So you can't use the field Ticket Number (I think it's not a date field), that doesn't make any sense. You must use a date field from your ticket app.
The date field must be referenced with@all of name of the date field
(nothing behind it)
The Ticket Number could be used if the number includes the date in number format, e.g. if the ticket number is structured like
20180913123 (where the first 8 digits are YYYYMMDD and represent the date the ticket is submitted).
If you don't have a date field in your Ticket app you can add a calculation field with @created on and then reference that calculation field with @all of
Rainer
Please sign in to leave a comment.
Comments
10 comments