0 Using Liquid to Calculate Dates Since Last Logon 1 Arran France posted 10 Years Ago Hey there, I'm trying to use Liquid to calculate the number of days since a user signed up to offer them helpful tips in their first Using the merge {% for User in Person.Users %} {{ User.CreatedDateTime }} {% endfor %} produces two dates and times, whereas using { User.CreatedDateTime }} produces one. I'm assuming this is what's called an array but the Lava documentation isn't too clear on how to use these. Could anyone give me an example of how to use these alongside filters and if statements
Arran France 9 years ago This is a reply to a comment from a while back! Could you explain the use of Person.Users[0], I can't find any documentation explaining why the [0] was included. Is this what fetches the oldest date an account was created?If so, what would the behaviour be if I included a 1 or a 2 instead?
Rock RMS 9 years ago Person.Users is an array of user accounts for the person. The [0] notation grabs the first one (arrays using zero based indexes so 0 = 1). Since the person is logged in you can assume there is at least one login. If you used [1] you would get the second. Most people though will only have one so you'd most likely get a null back (or possibly an exception :)
Arran France 9 years ago That's cleared that up thanks. I'm assuming Person.Users[0].LastLoginDateTime will record their active session as their last login so the value will always be "now" if they're logged in. Is there any way of fetching the login prior to that using Lava?