Voting in der Community ⬆️⬇️

Wenn euch Beiträge von anderen Usern gefallen, könnt ihr dies durch eine positive Bewertung zeigen und wenn ihr angemeldet seid, so sogar Punkte vergeben. Erfahrt hier mehr zu unserem Bewertungssystem: Voting in der deutschen Apple Support Community


Ein Apple Script, um das Osterdatum und davon abhängige bewegliche Feiertage zu berechnen

von: 
Zuletzt geändert: 19. Juli 2020 15:36
5 368 Zuletzt geändert 19. Juli 2020 15:36

Leider zeigt Apples Kalender noch nicht die Feiertage für das nächste Jahr an. Ich behelfe mir solange mit einem Apple Script, um die beweglichen Feiertage auszurechnen. Dieses Script benutzt die Gauß'sche Osterregel, um das Datum für Ostersonntag und Pfingsten auszurechnen. Man gibt einfach die Jahreszahl ein (es sollte ein Datum nach der Gregorianischen Kalenderreform sein - 1800-2200).


  • Öffne den Script Editor
  • Kopiere den Code in das Fenster.
  • Sichere es in einer Datei und klicke den "Run" Knopf ▶︎.
  • Gebe die gewünschte Jahreszahl ein.

In den Einstellungen des Script Editors kann man das Script Menü der Menüleiste zufügen. Dann kann man das Script direkt vom Skript Menü aufrufen.

-- Compute the easter date using Gauss algorithm
-- Author: Leonie 2011

set theDate to current date
set d to the day of theDate
set m to the month of theDate
set y to the year of theDate
set ts to the time string of theDate
set t to the time of theDate
set w to the weekday of theDate
set h to t / hours

display dialog "For which year do you want to know the easter date?:" default answer y buttons {"OK"} default button {"OK"}
--return the result
--copy the result as list to {the y, the button_pressed}
set y to the text returned of the result as number

if y < 1800 then return ("Sorry, the year must be in the range 1800:2200" & y)
if y < 1900 then
	set mm to 23
	set nn to n
else if y < 2100 then
	set mm to 24
	set nn to 5
else if y < 2200 then
	set mm to 24
	set nn to 6
else
	return "Sorry, the year must be in the range 1800:2200"
end if

set a to y mod 19
set b to y mod 4
set c to y mod 7
set d to (19 * a + mm) mod 30
set e to (2 * b + 4 * c + 6 * d + nn) mod 7

if 22 + d + e < 32 then
	set mon to 3 --March
else
	set mon to 4 --April
end if
if mon = 3 then
	set easterday to 22 + d + e
else
	set easterday to d + e - 9
	if easterday = 26 then set easterday to 19
	if (easterday = 25) and (d = 28) and (e = 6) and (a > 0) then set easterday to 19
end if
set ds to "" & easterday & "/" & mon & "/" & y
set rosemonday to the date string of ((date ds) - 48 * days)
set karfreitag to the date string of ((date ds) - 2 * days)
set easterdate to the date string of date ds
set pentacost to the date string of ((date ds) + 49 * days)
set ascension to the date string of ((date ds) + 39 * days)
set mayday to the date string of date ("1/5/" & y)
--set deutschEinheit to date ("3/10/" & y)
--set christmasEve to date ("24/12/" & y)

display dialog "Im Frühjahr " & y & " liegen die Feiertage wie folgt:
 Rosenmontag:  " & rosemonday & ",
 Karfreitag:  " & karfreitag & ",
 Ostern: 	" & easterdate & ",
 Himmelfahrt:  " & ascension & ", 
 Pfingsten:  " & pentacost & ",
 1. Mai: " & mayday buttons {"Danke"} default button {"Danke"}

Willkommen in der Apple Support Community
Ein Forum, in dem Apple-Kunden sich gegenseitig mit ihren Produkten helfen. Melde dich mit deiner Apple-ID an, um Mitglied zu werden.