I have been trying to figure out how to show a social feed that has a “time since posted” listed for each post. The goal was to have it be the same as Facebook or LinkedIn. If the post was 20 seconds old it would show “20s” if it was 3 hours old it would show “3h” and so on.
This is the definition of the data resources configured in the Data screen
My initial issue was figuring out how to do the calculation for a collection of records coming back from the server. It needs to be calculated each time for each object in the collection of records and can’t be something that is stored on the record. I do have a createdAt field that represents the time the post was created.
This is what the social post list screen looks like. It isn’t finished by any means but I have the time since post working and thought I would share how it works. You can see the time since post shown on the right side of the app screen for each post in the list. The nice side-effect of how this worked is that the time will update as often as your collection of records flow is called (mine is set for 100ms)
I think I have shared the key details on how I got this to work. Feel free to ask questions.
Also, Let me know if you have a more straightforward technique for doing this. I can’t say that my approach is elegant, but for now it gets it done I am new to Appgyver and it will be funny if there is just a setting or existing flow that does this automatically