I don’t think that this is quite right. The sun hitting the skin in the ultra violet spectrum creates vitamin d in the body.
The sun hitting the skin in the infra red spectrum creates melatonin in the mitochondria of the body and nitric oxide in the endothelium of capillaries of the body.
The infra red spectrum is long wave so it penetrates the body down to the bone.
Melatonin is lately being touted as a master antioxident because it is another pathway by which glutathione is created.
The Covid shutdown caused a lot of people to stay indoors, out of the sun, and contributed to vitamin D deficiency and susceptibility to Covid.