Discrete time crystal in the gradient-field Heisenberg model