Replace moment with date-utils

Also fix a bug where the program fails to end if there are no dependant
relations.