I think the tides have been turning on avoiding all sun exposure. While you obviously want to avoid getting burnt, the benefits of adequate sun exposure seem to outweigh the harms.
Rhee, H. J. van der, E. de Vries, and J. W. Coebergh. “Regular Sun Exposure Benefits Health.” Medical Hypotheses 97 (December 1, 2016): 34–37. https://doi.org/10.1016/j.mehy.2016.10.011.
"Since it was discovered that UV radiation was the main environmental cause of skin cancer, primary prevention programs have been started. These programs advise to avoid exposure to sunlight. However, the question arises whether sun-shunning behaviour might have an effect on general health. During the last decades new favourable associations between sunlight and disease have been discovered. There is growing observational and experimental evidence that regular exposure to sunlight contributes to the prevention of colon-, breast-, prostate cancer, non-Hodgkin lymphoma, multiple sclerosis, hypertension and diabetes. Initially, these beneficial effects were ascribed to vitamin D. Recently it became evident that immunomodulation, the formation of nitric oxide, melatonin, serotonin, and the effect of (sun)light on circadian clocks, are involved as well. In Europe (above 50 degrees north latitude), the risk of skin cancer (particularly melanoma) is mainly caused by an intermittent pattern of exposure, while regular exposure confers a relatively low risk. The available data on the negative and positive effects of sun exposure are discussed. Considering these data we hypothesize that regular sun exposure benefits health."
Hoel, David G., Marianne Berwick, Frank R. de Gruijl, and Michael F. Holick. “The Risks and Benefits of Sun Exposure 2016.” Dermato-Endocrinology 8, no. 1 (October 19, 2016). https://doi.org/10.1080/19381980.2016.1248325.
"This review considers the studies that have shown a wide range health benefits from sun/UV exposure. These benefits include among others various types of cancer, cardiovascular disease, Alzheimer disease/dementia, myopia and macular degeneration, diabetes and multiple sclerosis. The message of sun avoidance must be changed to acceptance of non-burning sun exposure sufficient to achieve serum 25(OH)D concentration of 30 ng/mL or higher in the sunny season and the general benefits of UV exposure beyond those of vitamin D."
This change in thinking has been a long-time coming. There have been results showing studies since the 90s showing lower melanoma mortality from those having more sun exposure, as described in this review:
Egan, Kathleen M., Jeffrey A. Sosman, and William J. Blot. “Sunlight and Reduced Risk of Cancer: Is The Real Story Vitamin D?” JNCI: Journal of the National Cancer Institute 97, no. 3 (February 2, 2005): 161–63. https://doi.org/10.1093/jnci/dji047.