Just for fun, here's a workaround for the DateSerial issue in LibreOffice
Basic (the fact that things like DateSerial(2018,13,59) isn't allowed. I am
at work so I could only test this in Excel (in which the function isn't
needed anyway), but it should work in LibreOffice Calc as well:
REM ***** BASIC *****
Option Explicit
Public Function MyDateSerial(lYear As Long, lMonth As Long, lDay As Long)
As Date
lYear = lYear + Int((lMonth - 1) / 12)
lMonth = 1 + (lMonth - 1) Mod 12
MyDateSerial = DateSerial(lYear, lMonth, 1) + lDay - 1
End Function
REM ***** END BASIC *****
Then use MyDateSerial instead of DateSerial, and you don't need to verify
month and date values, it will work as in Excel, but maybe a bit slower.
Hopefully not too slow, though.
Test (in Excel):
Debug.Print MyDateSerial(2018, 13, 59)
2019-02-28
Debug.Print MyDateSerial(2018, 14, 59)
2019-03-31
Debug.Print MyDateSerial(2019, 14, 59)
2020-03-30
The result of last example is of course expected, since 2020 is a leap year.
Thanks to the ",1) + lDay - 1" at the last line in the function, we get
away with it without having to check how many days each month has, which
makes the function look short and not so messy.
A little bit off topic, but since I mentioned it as a possible "bug" I
thought it would be appropriate to suggest a workaround for it. 
Kind regards
Johnny Rosenberg