How to Use Lead Prosper Payload Transformers to Convert Text Into Dates

When collecting lead data, you may sometimes get text-based time references like “Less than 6 months” or “Less than 2 years” instead of an actual date. While this may be fine for capturing intent, it’s not very useful if you want to pass along or store a precise date value.

With Lead Prosper’s payload transformers, you can solve this problem by chaining together two transformers:

  1. ||if_else – to replace the incoming text with a relative date string (like “6 months ago”).
  2. ||date – to convert that relative string into an actual date value.

Example Use Case

Let’s say you are collecting an incident date field in your campaign:

{{incident_date}} = Less than 2 Years

The field may contain values such as:

  • Less than a week
  • Less than a month
  • Less than 6 months
  • Less than 1 Year
  • Less than 2 Years
  • Less than 5 Years

Instead of leaving these as vague text entries, we can map them into precise dates.

Step 1 - Apply the ||if_else Transformer

The ||if_else transformer allows you to find and replace values. The format is:

ORIGINAL_VALUE->REPLACE_VALUE@@

  • ORIGINAL_VALUE = what your form actually collects
  • -> = separates original and replace values
  • REPLACE_VALUE = what you want to substitute in its place
  • @@ = separates multiple rules


For example, here’s how you could transform “Less than 2 Years” into “2 years ago”:

{{incident_date||if_else:[Less than a month->1 month ago@@Less than 6 months->6 months ago@@Less than 1 Year->1 year ago@@Less than 2 Years->2 years ago@@Less than 5 Years->5 years ago]}}


At this stage, “Less than 6 months” would become “6 months ago.”

Step 2 - Daisy Chain the ||date Transformer

Now that your values are replaced with relative date strings, you can pass them through the ||date transformer.

For example:

incident_date={{incident_date||if_else:[Less than a month->1 month ago@@Less than 6 months->6 months ago@@Less than 1 Year->1 year ago@@Less than 2 Years->2 years ago@@Less than 5 Years->5 years ago]||date:m/d/Y}}

Here’s what happens:

  1. Input: incident_date = Less than 6 months
  2. ||if_else replaces it:

    incident_date = 6 months ago

  3. ||date:m/d/Y converts it to a formatted date:

    incident_date = 03/09/2025

    (assuming today is 09/09/2025)

Final outcome: incident_date=03/09/2025


And that’s it. After applying the two transformers to the {{incident_date}} field are all set to convert the text values that are collected into actionable dates that your buyer’s system can accept. By combining the ||if_else and ||date transformers, you can turn vague text inputs into precise, formatted dates that are easy to work with. This approach not only standardizes the data you collect but also makes it more valuable to your buyers, who often require exact dates for compliance and decision-making. And because Lead Prosper lets you daisy chain multiple transformers together, you have the flexibility to keep refining your data from left to right until it’s in the perfect format for your campaigns.

Still need help? Contact Us Contact Us