And God said, Let there be lights in the firmament of heaven to divide the day from the night; and let them be for signs, and for seasons, and for days and years: (ASV)
See Genesis 1:11, where plants were made before the sun.
The Hebrew phrase ha'shamayim ve ha'erets, "the heavens and the earth" means more than the sum of its parts, i.e. the whole universe. Thus, the text is claiming in verse 1:1 that God created the sun, the moon and the stars during the first yom.
In verse 2, the frame of reference changes to the surface of the earth, where the luminaries were not yet visible. Isn't this what our current cosmological understanding tells us about the early conditions of our planet?
On yom two, God makes the atmosphere translucent, "letting there be light". That would certainly make photosynthesis possible. Later on, He makes the atmosphere transparent, letting the heavenly bodies to shine down on earth and to be used for calculating times and seasons. Isn't this development also something that our current cosmological understanding tells us about the early conditions of our planet?
Edit this section to note miscellaneous facts.