The Qur'an specifies the timing for keeping the fast during the month of Ramadan in the following verse:
...Eat and drink until the white streak of dawn is distinguishable from the black streak of dawn. Then keep the fast UNTIL THE NIGHT. (2:187) وَكُلُوا۟ وَٱشْرَبُوا۟ حَتَّىٰ يَتَبَيَّنَ لَكُمُ ٱلْخَيْطُ ٱلْأَبْيَضُ مِنَ ٱلْخَيْطِ ٱلْأَسْوَدِ مِنَ ٱلْفَجْرِ ۖ ثُمَّ أَتِمُّوا۟ ٱلصِّيَامَ إِلَى ٱلَّيْلِ
Firstly, it should be noted that the starting time of fasting is described in terms of the visible streaks of light at dawn. The specific contrast of the colours 'black' and 'white' are used to make a simple distinction regarding the exact stage of dawn when fasting begins. As dawn emerges during the twilight of dawn, various shades of colours may be observed, starting with the darker shades of blue and orange, then gradually moving to the lighter shades of white before sunrise. This verse makes clear that fasting begins when there is some sign of these lighter shades of white, described as the 'white streak of dawn'.
In the same verse, it is stated that fasting should proceed until the 'night'. The Arabic word used here - 'Layl', derived from the root La-Ya-La ل ي ل , literally means 'night' and is the period of time specified as the end of fasting. There are two ways to verify that this word is referring to the time when it is dark at night and not referring to the time of sunset or twilight. Firstly, we can check other parts of the Qur'an to see if there are references to that period of sunset or twilight and see if the same word La-Ya-La ل ي ل is used in that context. Secondly, we can study the Qur'anic usage of the word 'Layl' in other verses to see if the word is being used to mean the time of sunset / twilight or the time of night / darkness.
Verse 18:86 speaks of the 'setting of the sun' using the word 'Maghrib', derived from the root word Gha-Ra-Ba غ ر ب , which literally means to be 'hidden', to 'depart', or be 'absent'. In the context of the sun, this means the setting of the sun:
Until he reached the SETTING OF THE SUN, he found it to be setting in a murky spring and found a people in its vicinity. (18:86) ححَتَّىٰٓ إِذَا بَلَغَ مَغْرِبَ ٱلشَّمْسِ وَجَدَهَا تَغْرُبُ فِى عَيْنٍ حَمِئَةٍ وَوَجَدَ عِندَهَا قَوْمًا
Using the same word Gha-Ra-Ba غ ر ب , verses 20:130 and 50:39 repeat the message that the setting of the sun is a time when God is glorified or prayers are performed:
So persevere with what they say and proclaim the praises of your Lord before the rising of the sun and before the SETTING OF THE SUN. (20:130, 50:39) فَٱصْبِرْ عَلَىٰ مَا يَقُولُونَ وَسَبِّحْ بِحَمْدِ رَبِّكَ قَبْلَ طُلُوعِ ٱلشَّمْسِ وَقَبْلَ غُرُوبِهَا
Similarly, verse 17:78 speaks of the 'decline of the sun' in the context of the timing for prayers, referring to the moving of the sun down toward the horizon. The word used here is 'Duluk', derived from the root Da-La-Ka د ل ك , which literally means to 'decline', 'to set' or to 'go down'. Importantly, in this verse we find a distinction between the 'declining of the sun' and the 'darkness of the night', using the same word 'Layl' as used in verse 2:187 for the time of ending fast:
Establish the prayers regularly - AT THE DECLINE OF THE SUN until the DARKNESS OF NIGHT. (17:78) أَقِمِ ٱلصَّلَوٰةَ لِدُلُوكِ ٱلشَّمْسِ إِلَىٰ غَسَقِ ٱلَّيْلِ وَقُرْءَانَ ٱلْفَجْرِ
If God wanted to mean that fasting should end at or immediately after sunset, He could have used one of the other Arabic words to more accurately refer to this time period. For example, the Qur'an refers to the word 'Shafaq' in verse 84:16, derived from the root Sha-Fa-Qa ش ف ق , which means the glow of light that occurs after sunset and at dusk, or the 'evening twilight'. Once again, the very next verse after this serves to demonstrate the distinction between 'Layl' (night) and the time of sunset or twilight, since night is separately mentioned as something which 'covers' or 'envelopes':
I swear by the TWILIGHT, and by the NIGHT with that which it covers. (84:16-17) فَلَآ أُقْسِمُ بِٱلشَّفَقِ وَٱلَّيْلِ وَمَا وَسَقَ
These verses show examples of words which could have been used to refer to 'sunset' or 'twilight' in verse 2:187, if that was indeed what God intended by the verse. Instead, the word used is very different to these words - the word 'Layl' - La-Ya-La ل ي ل - meaning night. There are indications in the Qur'an that this word 'Layl' refers to night-time when there is no visible light in the sky. For example, verse 36:37 clearly states that God has made the night 'dark', using the Arabic word 'Aghtasha', derived from the root Gha-Ta-Sha غ ط ش , which literally means 'darkness' or 'blackness' in the absence of light:
A sign for them is the night; We remove from it the day and they are left in DARKNESS. (36:37) وَءَايَةٌ لَّهُمُ ٱلَّيْلُ نَسْلَخُ مِنْهُ ٱلنَّهَارَ فَإِذَا هُم مُّظْلِمُونَ
The above verse unequivocally tells us what night is. It explicitly states that God removes the day from it such that we are left with actual darkness. Similarly, verses 91:1-4 use the same word Gha-Ta-Sha غ ط ش to tell us that 'Layl' constitutes of darkness:
...their faces are covered with the DARKNESS OF NIGHT. (91:1-4) كَأَنَّمَآ أُغْشِيَتْ وُجُوهُهُمْ قِطَعًا مِّنَ ٱلَّيْلِ مُظْلِمًا
Furthermore, verse 10:27 uses the word 'Muzliman' to describe the night, a word which is derived from the root Za-La-Ma ظ ل م , literally meaning 'darkness':
He has made the NIGHT DARK, from which He brings out the morning. (79:29) وَأَغْطَشَ لَيْلَهَا وَأَخْرَجَ ضُحَىٰهَا
In reference to the timing for prayers, verse 17:78 refers to 'darkness of the night' using the word 'Ghasaq'. This word is derived from the root Gha-Sa-Qa غ س ق , which also literally means 'darkness' or 'blackness':
Establish the prayers regularly - at the decline of the sun until the DARKNESS OF NIGHT. (17:78) أَقِمِ ٱلصَّلَوٰةَ لِدُلُوكِ ٱلشَّمْسِ إِلَىٰ غَسَقِ ٱلَّيْلِ وَقُرْءَانَ ٱلْفَجْرِ
In addition to these explicit references to night being dark, verses 91:1-4 speak of the sun and its light/brightness and state that 'Layl' is the time when this is 'concealed' or 'covered':
I swear by the sun and its brightness/light, and by the moon which follows it, and by the day which reveals it, and by the NIGHT WHICH CONCEALS IT. (91-1-4) وَٱلشَّمْسِ وَضُحَىٰهَا وَٱلْقَمَرِ إِذَا تَلَىٰهَا وَٱلنَّهَارِ إِذَا جَلَّىٰهَا وَٱلَّيْلِ إِذَا يَغْشَىٰهَا
In the above verse, if God wanted to mean 'sunset' or 'twilight', it would not be necessary to mention the 'brightness' or 'light' associated with the sun, since it continues to state that the night 'conceals' or 'covers' this. In fact, it would be astronomically more fitting to leave out the 'brightness/light' part in such case because the verse would then state that the daytime reveals the sun and the nighttime conceals it. Astronomically, twilight includes the time when the sun is still below the horizon before sunrise and when it lowers below the horizon after sunset. Twilight occurs when the earth's atmosphere reflects some of the light onto the horizon. If the verse stated only the sun is being concealed, this would imply that the period of twilight is included because the sun being concealed does not necessarily mean that the light or brightness associated with it is also being concealed. However, the sun's brightness or light is mentioned in the verse along with the sun. As the night conceals all of this, we can understand that the word 'Layl' means a time when neither light nor the sun is present.
In verses 22:61 and 31:29, God states that He 'merges the night into the day', and 'the day into the night', referring to the period of twilight at each end of the day:
This is because God merges the night into the day and the day into the night. (22:61) ذَٰلِكَ بِأَنَّ ٱللَّهَ يُولِجُ ٱلَّيْلَ فِى ٱلنَّهَارِ وَيُولِجُ ٱلنَّهَارَ فِى ٱلَّيْلِ
Have you not seen how God merges the night into the day and the day into the night? (31:29) أَلَمْ تَرَ أَنَّ ٱللَّهَ يُولِجُ ٱلَّيْلَ فِى ٱلنَّهَارِ وَيُولِجُ ٱلنَّهَارَ فِى ٱلَّيْلِ
It is important to note that the concept of merging two things into one does not necessarily imply that the merged outcome includes these two things in their original form. In other words, merging day into night effectively results in the formation of a third thing: twilight. We cannot reasonably infer that twilight is also a part of the night simply because twilight is composed of a mixture of day and night. Rather, twilight is a separate and distinctive period of time itself like the day and the night.
We can gather that the use of 'Layl' in verse 2:187 does not refer to a period of sunset or twilight with light visible in the sky. If God wanted to refer to such a period of time, He could easily have used other Arabic terms which are used elsewhere in the Qur'an. In verse 2:187 itself, God refers to the emergence of twilight as a distinction of the 'white streak of dawn from the dark streak of dawn' when beginning fast. However, there is no such description referring to the time when ending fast. The use of basic colours 'black' and 'white' for comparison indicate that it is expected for individuals to make simple and direct observation with the naked eye for determining these times, instead of using sophisticated techniques or telescopic equipment. With regard to the word 'Layl', there are several verses in the Qur'an which specifically define this as a period after sunset/twilight when there is actual darkness with no light visible. It remains the responsibility of each individual to make relevant observations at the time of beginning and ending fast, in order to make the most reasonable judgement on the Qur'anic timelines.