Scalar datetime64 and timedelta64 support

It's translated from Numpy's C code, which is why it's a bit non-trivial to re-create. We can probably get rid of it, but may need to later reimplement it :)