Firstly, the way gravity affects time is completely different from the way gravity affects mass. Do a search on "gravitational time dilation". Secondly, gravity affects light because it has energy. This is governed by the Einstein Field Equation. Thirdly, the black-holes tag is irrelevant since all objects do have gravitational pull. Fourthly, the visible-light tag doesn't apply here. It applies to optics only, that too in the visible spectrum. Even if you want to talk about light, there is the electromagnetic-radiation tag. It is clearly stated in the description.

**Edit:**

Time dilation is very different from objects getting attracted to gravity. Instead, it is because of the curvature of spacetime.

Gravitational time dilation is given by

$$\frac{c_0^2\mbox{d}t^2}{\mbox{d}s^2}$$

For a Schwarzschild metric, assuming the velocity of the observer is 0 all the time, for example, it is

$$t=\tau\sqrt{1-\frac{r_s}{r}}$$

Where t is coordinate time and tau is proper time.

This is obtained from the Einstein Field Equation (EFE).

It can be obtained by applying Hamilton's principle/Principle of stationary action to the Einstein Hilbert Lagrangian Density:

$$\mathcal L=\lambda R$$

Then, it can be found that

$$G_{\mu\nu}=\frac{1}{2\lambda}T_{\mu\nu}$$

Where $T_{\mu\nu}$ is the Stress-Energy-Momentum Tensor and we defined the Einstein tensor $G_{\mu\nu}$ as:

$$G_{\mu\nu}=R_{\mu\nu}-\frac{1}{2}Rg_{\mu\nu}$$

By ensuring that GR goes to Newtonian Gravity at the classical limit,

$$\frac{1}{2\lambda}=\frac{8\pi G}{c_0^4}$$

So clearly this involves the stress energy momentum tensor which has momentum in its componnents, obviously by definition.

So, in conclusion, it makes NO sense to say time has mass, its only a dimension and light has no (rest) mass but has momentum, which can be given by:

$$p=\frac{\hbar\omega}{c_0}$$

The momentum also contributes to its stress-energy momentum tensor and thus to the gravitational pull.