Your problem is right at the beginning with the equation v(t) = at
Think about what this means. This means that the observer on earth sees the spaceship moving with a constant acceleration. However, this cannot be possible as if you were to wait long times you would eventually get v > c! So really the acceleration cannot be constant, it is a function of time. Furthermore, the value of the acceleration is dependent on the frame you are observing. You can see this by taking:
x′=γ(x−vt)And differentiating it twice with respect to t' (messy), in the x direction, you get:
a′=γ3(1−uv/c2)31aNow the trick to solving questions such as the one you asked is to define an instantaneous rest frame moving at v(t) along with the spaceship. This makes u = v and t' = tau (the proper time) in the above equation giving:
a′=(1−v2/c2)3/21a=dτdv′Rearranging we get:
dtdv=dτdv′(1−v2/c2)3/2so
dτdv=dτdtdτdv′(1−v2/c2)3/2=(1−v2/c2)dτdv′Integration gives:
v(τ)=ctanh(v′(τ)/c)Using this value of v we can now write:
dτdt=(1−v2/c2)−1/2=cosh(cv′(τ))You can integrate this depending on the physical situation. In the case where
v′=fτwith f a constant, you get:
t=t0+fcsinh(fτc)So in short, it's nowhere near as straightforward as you thought it would be!