How to calculate the time of Ekadashi days? Is there an official reference algorithm for calculating the Ekadashi days?

I found the textual description of Ekadashi calculation on wikipedia but can't really make sense of it in order to write the code.

I already have the (java) code for calculating the new/full moon phases, and originally assumed that Ekadashi would be as easy as appending 11 days to the time of new and full moon but apparently this approach is not providing correct results.

Update:

Based on James's answer the answer is 11 lunar days and 26 lunar days after new moon (not gregorian days).

The required conditional adjustments are described in chapter 1.4 of Vaisnava Events Calculation which don't match the ones described in the wikipedia article.
It is not clear that it can be calculated in a simple way

The length of the lunar month varies between 29.3 and 29.8 days, due to perturbations from the sun. Since ekadashi is based on the actual astronomical moon, you would need to know the length of the current synodic month in order to work out when ekadashi is.  You can predict the motion of the moon very accurately, but the calculation is beyond this answer.

However on average, each lunar month is 29.53 days, so ekadashi is the day which is 259.86 hours and 614.22 hours after each new moon. The calculation is
24 hours/day * 11/30 * 29.53 days

And New moon last occurred on 4th Feb at 21.03, you can add 29.53 days to find the next new moon etc.

The irregular motion of the moon is why the Christians choose to use an "average moon" and an "average sun" for their calculation of Easter.