How to calculate the period of a lunar mansion?
If I understand the concept of &quot;mansion&quot; correct, it is similar to an astrological sign, and astrononomically simply refering to a certain zone in which a certain object (here: the Moon) can be seen on the sky.
More specifically, a Lunar station - [Manazilu ʾl-Qamar منازل القمر] according to Islamic astronomical system seems a certain sector of the sky and the sky is divided into 28 of theses sectors. This defines a celestial coordinate system with $x$-axis being the ecliptic, the celestial longitude. The longitude is measured in degrees east of the vernal equinox (the ascending intersection of the ecliptic and equator):
An algorithm to determine the Lunar station at a given time would have as input parameter only the position of the Moon on the sky (actually only the Ecliptic longitude $\lambda$ of the Moon) and check in which interval $\lambda$ lies. The lower boundary of each mansion is given in the 3rd column in the Wikipedia-table shown in the question in a rather inconvenient format, namely in degrees and minutes from a start of a zodiac symbol.
In a first step, you would have to convert the Wikipedia list to a intervals with real celestial longitudes. You would end up with 28 if-clauses in your algorithm to determine a string $s$ containing the name of the lunar mansion:
$s_{\rm lunar~mansion}(\lambda) = \left\{ \substack{ {An-Nath} {\rm ~if~}
  0 \leq \lambda &lt; 12^\circ 51' \\
\vdots \\
Butnu 'l-Hut {\rm ~if~} 0 \leq \lambda &lt; 347^\circ9' = 330^\circ +17^\circ 9' 
}\right.$
Here we used the fact that Pisces starts at $330^\circ$ celestial longitude.
Since you are after the begin and end dates for a each lunar mansion you have to calculate at which time the Moon celestial longitude $\lambda$ equals to the boundaries of the 28 intervals. I would do it vice versa and calculate for each day  of the year at 00:00:01 local time the longitude of Moon and then use $s(\lambda)$. You will end up with a table of 365 or 366 date- string-pairs. In the last step, you discard all lines of the table where a string repeats and reduce the list to 28 entries, with the start dates in the first column.