List of upcoming birthdays and jubilees

I guess the solution is again very simple (or not feasible at all), let’s see.

I want to display a list of upcoming birthdays and upcoming jubilees. Both data fields contain the dates with the birth year respectively the year of the event for the jubilee.

Having an LFD, I want to show only the next 6 birthdays, but I simply chose a birthdate - greater than today obviously it takes the year into account and the resulting list is empty.

Hi Birgit,

What is the format of the date stored in the data source and what filter did you choose for the LFD?


Apologies, somehow I did not see that there was a reply.

It is obviously coming from the date picker, and it is stored in the data source as YYYY-MM-DD

Hi Birgit,

You can achieve your goal by using the following code. Put this code in the javascript tab of the screen where you are showing the LFD.

Fliplet.Hooks.on('flListDataBeforeRenderList', function(options) {
  let number_of_upcoming_birthdays_to_display = 6;

  options.records.forEach(function(row) {
    var birthday = moment(;

    var today = moment().format('YYYY-MM-DD');

    var age = moment(today).diff(birthday, 'years');

    var nextBirthday = moment(birthday).add(age, 'years');
    nextBirthday = moment(birthday).add(age + 1, 'years');['difference'] = nextBirthday.diff(today, 'days');
  options.records.sort(function(a, b) {
    return -;

  options.config.limitEntries = number_of_upcoming_birthdays_to_display;
  options.config.enabledLimitEntries = true;

You can notice the second line of code “let number_of_upcoming_birthdays_to_display = 6;”
You can change the 6 to your preferred choice of entries, you want to show on the page. For example, changing it to 10 will show you the top 10 upcoming birthdays.

One other thing is that I assumed the field name is Birthday. In case you have a different name for the field. You can change the following line of code from

var birthday = moment(;


var birthday = moment(;

You can notice that the Birthday text in the code is changed to changedfieldname.

I hope this information will help you. Below is the screenshot of the code and output.

Thanks so much!

For some reason, the sorting is not working though

Any idea what the reason can be?

I think you missed this information.

What is your field name in the DS for the birthday? Did you change the field name in the code to match the DS field name?

Hi, yes, I’ve changed that. It is called “Geburtstag” in my app, and I have adapted the code to that.

Hi Birgit,

How are you sorting? Can you share images of your LFD setting for sorting configuration?



Hi Birgit,

Can you share the images of your data view settings too?