Put the summary of the bug you're having here
What I expected to happen was...:
The sun to set and the moon to rise, beginning night.
What actually happened was...:
A little bit before the sun is supposed to set, it teleports to where it was at the beginning of the day. This effectively creates a single player world where night never comes and it is always day.
Steps to Reproduce:
1. Have a singleplayer world on 1.14.2
2. Use the default gamerules with no mods or datapacks that alter how the day/night cycle works
3. Around afternoon in a Minecraft day, the sun will go back to where it was in the morning.
I fixed the problem. It was in fact not a bug with Minecraft, but instead, because of the Optifine version I was using. I apologize for any inconvenience.