This article is from the Calendars FAQ, by Claus Tondering email@example.com with numerous contributions by others.
Saudi Arabia doesn't rely on a visual sighting of the crescent moon to
fix the start of a new month. Instead they base their calendar on a
calculated astronomical moon.
Since 1999 (1420 AH) the rule has been as follows: On the 29th day of
an Islamic month, the times when the sun and the moon set are
compared. If the sun sets before the moon, the next day will be the
first of a new month; but if the moon sets before the sun, the next
day will be the last (30th) of the current month.
The times for the setting of the sun and the moon are calculated for
the coordinates of Mecca.