The first thing you have to do is when you think you have a dermatitis which is excavated by light you should wear full clothes which covers whole area which is affected. In addition you should also go for a sunscreen, definitely you should choose a broad spectrum sunscreen so you get protection from both UVA and UVB light, look for a SPF of minimum 40, prefer medicated sunscreens. Sometimes dermatologists do a patch test by taking the chemicals and apply it on your skin and see if the same allergic reaction has been reproduced. So these are all the things that could be happening with the sun but sun is the great source of vitamin D, the sun is needed for your normal activity but may cause some problems so to prevent them ensure you use sunscreen every day.
source