Turning created_at Into Real Times

Options

My goal is to create a posting mechanism where the post will show how long ago it was posted. For example, "2 hours ago" or "3 weeks" ago.

How would I go about this?

Tagged:

Answers

  • Max
    Max Member
    edited October 2023
    Options

    try doing it with function in CRUD, utilize "now" value and created_at and do a datediff with filters or use other math way. and then just output result you want as additional "virtual" key in your data.
    here is small example where i add a virtual key price: with a dynamic value to every record in result. it is doing several calculations in background and therefore in api call result every record always have own value from function in a "new" key.

    inside of function a math result is added as key:value pair to every record, with "set" filter