add functions inspired by MATLAB implementation

days360 is very tricky.
also make a separate file for testing.