Skip to content

Instantly share code, notes, and snippets.

Last active January 3, 2021 08:47
Show Gist options
  • Save stefansundin/8413812 to your computer and use it in GitHub Desktop.
Save stefansundin/8413812 to your computer and use it in GitHub Desktop.
Google Calendar week numbers and Swedish namedays.
<?xml version="1.0" encoding="utf-8" ?>
<ModulePrefs title="Add Name Days" title_url="" description="Makes it easier to add name days to Google Calendar." height="100" width="400" scrolling="true" author="Stefan Sundin" />
<Content type="html"><![CDATA[
<style type="text/css">
#main {
border: 1px solid green;
padding: 3px 0;
font-family: Arial, Verdana, sans-serif;
font-size: 12px;
text-align: center;
<div id="main">
<label for="cal"><input id="cal" type="checkbox" checked="checked"> <span id="l10n-cal"></span></label><br />
<label for="gadget"><input id="gadget" type="checkbox"> <span id="l10n-gadget"></span></label><br />
<label for="apps"><input id="apps" type="checkbox"> <span id="l10n-apps"></span></label><br />
<input id="button" type="submit" onclick="submit();" />
<script type="text/javascript">
var db = {
se: {
title: "Namnsdagar",
country: "Swedish",
cal: "Lägg till kalendern med flaggor",
gadget: "Lägg till gadgeten",
apps: "Jag använder Google Apps",
button: "Lägg till namnsdagar till min kalender!",
domain: "Skriv in din domän:",
noob: "Du måste kryssa i antingen kalendern med flaggor eller gadgeten, eller båda. Noob.",
cid: "jootrf8lq729uohh03av30jqas",
en: {
title: "Name days",
country: "English",
cal: "Add the calendar with flags",
gadget: "Add the gadget",
apps: "I use Google Apps",
button: "Add name days to my calendar!",
domain: "Enter your domain:",
noob: "Check the calendar with flags checkbox or the gadget checkbox. Noob.",
cid: "jootrf8lq729uohh03av30jqas",
var l10n =;
gadgets.util.registerOnLoadHandler(function() {
function update() {
var cal = document.getElementById("l10n-cal");
var gadget = document.getElementById("l10n-gadget");
var apps = document.getElementById("l10n-apps");
var button = document.getElementById("button");
button.value = l10n.button;
function submit() {
var params = [];
if (document.getElementById("cal").checked) {
if (document.getElementById("gadget").checked) {
if (params.length == 0) {
if (document.getElementById("apps").checked) {
var domain = prompt(l10n.domain, "");
if (domain != null) {""+domain+"/render?"+params.join("&"));
else {""+params.join("&"));
function clear(el) {
while (el.firstChild) {
<?xml version="1.0" encoding="utf-8" ?>
<ModulePrefs title="Add Google Calendar Week Numbers" title_url="" description="" width="400" height="80" scrolling="true" author="Stefan" />
<Content type="html"><![CDATA[
<style type="text/css">
#main {
border: 1px solid green;
padding: 3px 0;
font-family: Arial, Verdana, sans-serif;
font-size: 12px;
text-align: center;
<div id="main">
<strong>Add week numbers</strong><br>
<label for="gapps"><input id="gapps" type="checkbox"> I use Google Apps</label><br />
<input type="submit" value="Add week numbers to my calendar!" onclick="submit();" />
<script type="text/javascript">
function submit() {
var params = "";
if (document.getElementById("gapps").checked) {
var domain = prompt("Enter your domain:", "");
if (domain != null) {""+domain+"/render?"+params);
else {""+params);
/* Stefan Sundin - 2010-10-06 - released to public domain
Code to generate ISO week numbers in iCal format for Google Calendar.
Help choosing the correct dates:
Site generating calendars:
The first week of a year is the week that contains the first Thursday of the year.
Note 2010-10-06: The week numbers now span 7 days to show up in day view on all days.
if (!isset($_GET["date"])) {
echo "You have to set the date of the first day in week 1. E.g.: ?date=2013-12-30&numweeks=52\n";
$date = strtotime($_GET["date"]);
$numweeks = 52;
if (isset($_GET["numweeks"])) {
$numweeks = (int)$_GET["numweeks"];
header("Content-Type: text/calendar");
header('Content-Disposition: inline; filename="weeks'.date('Y',$date+60*60*24*31).'-'.(date('N',$date)==1?'monday':'sunday').'.ics"');
for ($week=1; $week <= $numweeks; $week++) {
$dtstart = date('Ymd', $date);
$dtend = date('Ymd', $date+60*60*24*7);
$weekpad = str_pad($week, 2, "0", STR_PAD_LEFT);
echo <<<WEND
SUMMARY:Week $week
$date += 60*60*24*7;
#!/usr/bin/env python
# Code to generate ISO week numbers in iCal format for Google Calendar.
# Help choosing the correct dates:
# Site generating calendars:
# The first week of a year is the week that contains the first Thursday of the year.
import time
import datetime
# What is the date on which the first week of the year starts?
# date =, 1, 4)
# date =, 1, 2)
# date =, 1, 1)
# date =, 12, 31)
# date =, 12, 30)
date =, 12, 30)
# How many weeks in this year? (see wikipedia link above)
weeks = 53
one_month = datetime.timedelta(days=31)
one_week = datetime.timedelta(days=7)
day = "monday" if date.weekday() == 0 else "sunday"
fn = "weeks-"+str((date + one_month).year)+"-"+day+".ics"
print("Building "+fn+" ...")
f = open(fn, "wb")
for week in range(1,weeks+1):
dtstart = date.strftime("%Y%m%d")
dtend = (date + one_week).strftime("%Y%m%d")
SUMMARY:Week "+str(week)+"\n\
X-GOOGLE-CALENDAR-CONTENT-ICON:"+("%02d" % week)+".png\n\
date += one_week
# -*- coding: utf-8 -*-
import sqlite3
# Settings
lang = "se"
# Get lang
lang = input("Enter country code: ")
fn = "namedays-"+lang+".json"
# Open database
print("Opening database ...")
conn = sqlite3.connect("namedays-"+lang+".db")
conn.text_factory = str
c = conn.cursor()
# Let's do this thing!
print("Building", fn, "...")
f = open(fn, "wb")
names: [\n", "UTF-8"))
month = 1
while month <= 12:
print("Month "+str(month)+":", end=" ")
c.execute("SELECT names FROM namedays WHERE month == ? ORDER BY day", (month,))
names = c.fetchall()
f.write(bytes("\t\t\t[", "UTF-8"))
first = True
for name in names:
print(name[0], end="; ")
if first:
first = False
f.write(bytes("\""+name[0]+"\"", "UTF-8"))
f.write(bytes(", \""+name[0]+"\"", "UTF-8"))
f.write(bytes("],\n", "UTF-8"))
month = month+1
f.write(bytes(" ],\n", "UTF-8"))
# Clean up
# -*- coding: utf-8 -*-
import sqlite3
import time
import datetime
# Settings
lang = "se"
months = {1:"Januari", 2:"Februari", 3:"Mars", 4:"April", 5:"Maj", 6:"Juni", 7:"Juli", 8:"Augusti", 9:"September", 10:"Oktober", 11:"November", 12:"December"}
# Get year
year = int(input("Enter year: "))
fn = "namedays-"+lang+"-"+str(year)+".ics"
# Open database
print("Opening database ...")
conn = sqlite3.connect("namedays-"+lang+".db")
conn.text_factory = str
c = conn.cursor()
# Let's do this thing!
print("Building", fn, "...")
f = open(fn, "wb")
\n", "UTF-8"))
dt =, 1, 1)
while dt.year == year:
month = dt.month
day =
print(dt.strftime("%d %B")+":", end=" ")
c.execute("SELECT names FROM namedays WHERE month == ? AND day == ?", (month, day))
names = c.fetchone()[0]
print("No data!")
dt += datetime.timedelta(days=1)
dtstart = dt.strftime("%Y%m%d")
dt += datetime.timedelta(days=1)
dtend = dt.strftime("%Y%m%d")
url = ""+months[month]
SUMMARY:"+names+" – "+str(day)+" "+months[month].lower()+"\n\
\n", "UTF-8"))
f.write(bytes("END:VCALENDAR\n", "UTF-8"))
# Clean up
<?xml version="1.0" encoding="utf-8"?>
<ModulePrefs title="Name Days" title_url="" description="Displays name days. Currently only Swedish name days." height="80" author="Stefan Sundin">
<Require feature="google.calendar-0.5" />
<Optional feature="settitle" />
<Content type="html">
<!DOCTYPE html>
<style type="text/css">
body {
margin: 3px;
font-size: 12px;
overflow: hidden;
background: white;
#about {
display: block;
float: right;
margin: 4px;
cursor: pointer;
color: blue;
text-decoration: none;
#more {
text-align: center;
<script type="text/javascript">
var dayTimer;
var db = {
se: {
calid: 'jootrf8lq729uohh03av30jqas',
wikiurl: 'över_namnsdagar_i_Sverige_i_datumordning',
months: ['Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December'],
l10n: {
title: 'Namnsdagar',
country: 'Swedish',
today: 'Idag',
tomorrow: 'I morgon',
wikipedia: 'Läs mer om namnen',
website: 'Om gadgeten',
add: 'Lägg till i min kalender',
names: [
['Nyårsdagen', 'Svea', 'Alfred, Alfrida', 'Rut', 'Hanna, Hannele', 'Kasper, Melker, Baltsar', 'August, Augusta', 'Erland', 'Gunnar, Gunder', 'Sigurd, Sigbritt', 'Jan, Jannike', 'Frideborg, Fridolf', 'Knut', 'Felix, Felicia', 'Laura, Lorentz', 'Hjalmar, Helmer', 'Anton, Tony', 'Hilda, Hildur', 'Henrik', 'Fabian, Sebastian', 'Agnes, Agneta', 'Vincent, Viktor', 'Frej, Freja', 'Erika', 'Paul, Pål', 'Bodil, Boel', 'Göte, Göta', 'Karl, Karla', 'Diana', 'Gunilla, Gunhild', 'Ivar, Joar'],
['Max, Maximilian', 'Kyndelsmässodagen', 'Disa, Hjördis', 'Ansgar, Anselm', 'Agata, Agda', 'Dorotea, Doris', 'Rikard, Dick', 'Berta, Bert', 'Fanny, Franciska', 'Iris', 'Yngve, Inge', 'Evelina, Evy', 'Agne, Ove', 'Valentin', 'Sigfrid', 'Julia, Julius', 'Alexandra, Sandra', 'Frida, Fritiof', 'Gabriella, Ella', 'Vivianne', 'Hilding', 'Pia', 'Torsten, Torun', 'Mattias, Mats', 'Sigvard, Sivert', 'Torgny, Torkel', 'Lage', 'Maria', 'Skottdagen'],
['Albin, Elvira', 'Ernst, Erna', 'Gunborg, Gunvor', 'Adrian, Adriana', 'Tora, Tove', 'Ebba, Ebbe', 'Camilla', 'Siv', 'Torbjörn, Torleif', 'Edla, Ada', 'Edvin, Egon', 'Viktoria', 'Greger', 'Matilda, Maud', 'Kristoffer, Christel', 'Herbert, Gilbert', 'Gertrud', 'Edvard, Edmund', 'Josef, Josefina', 'Joakim, Kim', 'Bengt', 'Kennet, Kent', 'Gerda, Gerd', 'Gabriel, Rafael', 'Marie bebådelsedag', 'Emanuel', 'Rudolf, Ralf', 'Malkolm, Morgan', 'Jonas, Jens', 'Holger, Holmfrid', 'Ester'],
['Harald, Hervor', 'Gudmund, Ingemund', 'Ferdinand, Nanna', 'Marianne, Marlene', 'Irene, Irja', 'Vilhelm, William', 'Irma, Irmelin', 'Nadja, Tanja', 'Otto, Ottilia', 'Ingvar, Ingvor', 'Ulf, Ylva', 'Liv', 'Artur, Douglas', 'Tiburtius', 'Olivia, Oliver', 'Patrik, Patricia', 'Elias, Elis', 'Valdemar, Volmar', 'Olaus, Ola', 'Amalia, Amelie, Emelie', 'Anneli, Annika', 'Allan, Glenn', 'Georg, Göran', 'Vega', 'Markus', 'Teresia, Terese', 'Engelbrekt', 'Ture, Tyra', 'Tyko', 'Mariana'],
['Valborg', 'Filip, Filippa', 'John, Jane', 'Monika, Mona', 'Gotthard, Erhard', 'Marit, Rita', 'Carina, Carita', 'Åke', 'Reidar, Reidun', 'Esbjörn, Styrbjörn', 'Märta, Märit', 'Charlotta, Lotta', 'Linnea, Linn', 'Halvard, Halvar', 'Sofia, Sonja', 'Ronald, Ronny', 'Rebecka, Ruben', 'Erik', 'Maj, Majken', 'Karolina, Carola', 'Konstantin, Conny', 'Hemming, Henning', 'Desideria, Desirée', 'Ivan, Vanja', 'Urban', 'Vilhelmina, Vilma', 'Beda, Blenda', 'Ingeborg, Borghild', 'Yvonne, Jeanette', 'Vera, Veronika', 'Petronella, Pernilla'],
['Gun, Gunnel', 'Rutger, Roger', 'Ingemar, Gudmar', 'Solbritt, Solveig', 'Bo', 'Gustav, Gösta', 'Robert, Robin', 'Eivor, Majvor', 'Börje, Birger', 'Svante, Boris', 'Bertil, Berthold', 'Eskil', 'Aina, Aino', 'Håkan, Hakon', 'Margit, Margot', 'Axel, Axelina', 'Torborg, Torvald', 'Björn, Bjarne', 'Germund, Görel', 'Linda', 'Alf, Alvar', 'Paulina, Paula', 'Adolf, Alice', 'Johannes Döparens dag', 'David, Salomon', 'Rakel, Lea', 'Selma, Fingal', 'Leo', 'Peter, Petra', 'Elof, Leif'],
['Aron, Mirjam', 'Rosa, Rosita', 'Aurora', 'Ulrika, Ulla', 'Laila, Ritva', 'Esaias, Jessika', 'Klas', 'Kjell', 'Jörgen, Örjan', 'André, Andrea', 'Eleonora, Ellinor', 'Herman, Hermine', 'Joel, Judit', 'Folke', 'Ragnhild, Ragnvald', 'Reinhold, Reine', 'Bruno', 'Fredrik, Fritz', 'Sara', 'Margareta, Greta', 'Johanna', 'Magdalena, Madeleine', 'Emma', 'Kristina, Kerstin', 'Jakob', 'Jesper', 'Marta', 'Botvid, Seved', 'Olof', 'Algot', 'Helena, Elin'],
['Per', 'Karin, Kajsa', 'Tage', 'Arne, Arnold', 'Ulrik, Alrik', 'Alfons, Inez', 'Dennis, Denise', 'Silvia, Sylvia', 'Roland', 'Lars', 'Susanna', 'Klara', 'Kaj', 'Uno', 'Stella, Estelle', 'Brynolf', 'Verner, Valter', 'Ellen, Lena', 'Magnus, Måns', 'Bernhard, Bernt', 'Jon, Jonna', 'Henrietta, Henrika', 'Signe, Signhild', 'Bartolomeus', 'Lovisa, Louise', 'Östen', 'Rolf, Raoul', 'Fatima, Leila', 'Hans, Hampus', 'Albert, Albertina', 'Arvid, Vidar'],
['Sam, Samuel', 'Justus, Justina', 'Alfhild, Alva', 'Gisela', 'Adela, Heidi', 'Lilian, Lilly', 'Kevin, Roy', 'Alma, Hulda', 'Anita, Annette', 'Tord, Turid', 'Dagny, Helny', 'Åsa, Åslög', 'Sture', 'Ida', 'Sigrid, Siri', 'Dag, Daga', 'Hildegard, Magnhild', 'Orvar', 'Fredrika', 'Elise, Lisa', 'Matteus', 'Maurits, Moritz', 'Tekla, Tea', 'Gerhard, Gert', 'Tryggve', 'Enar, Einar', 'Dagmar, Rigmor', 'Lennart, Leonard', 'Mikael, Mikaela', 'Helge'],
['Ragnar, Ragna', 'Ludvig, Love', 'Evald, Osvald', 'Frans, Frank', 'Bror', 'Jenny, Jennifer', 'Birgitta, Britta', 'Nils', 'Ingrid, Inger', 'Harry, Harriet', 'Erling, Jarl', 'Valfrid, Manfred', 'Berit, Birgit', 'Stellan', 'Hedvig, Hillevi', 'Finn', 'Antonia, Toini', 'Lukas', 'Tore, Tor', 'Sibylla', 'Ursula, Yrsa', 'Marika, Marita', 'Severin, Sören', 'Evert, Eilert', 'Inga, Ingalill', 'Amanda, Rasmus', 'Sabina', 'Simon, Simone', 'Viola', 'Elsa, Isabella', 'Edit, Edgar'],
['Allhelgonadagen', 'Tobias', 'Hubert, Hugo', 'Sverker', 'Eugen, Eugenia', 'Gustav Adolf', 'Ingegerd, Ingela', 'Vendela', 'Teodor, Teodora', 'Martin, Martina', 'Mårten', 'Konrad, Kurt', 'Kristian, Krister', 'Emil, Emilia', 'Leopold', 'Vibeke, Viveka', 'Naemi, Naima', 'Lillemor, Moa', 'Elisabet, Lisbet', 'Pontus, Marina', 'Helga, Olga', 'Cecilia, Sissela', 'Klemens', 'Gudrun, Rune', 'Katarina, Katja', 'Linus', 'Astrid, Asta', 'Malte', 'Sune', 'Andreas, Anders'],
['Oskar, Ossian', 'Beata, Beatrice', 'Lydia', 'Barbara, Barbro', 'Sven', 'Nikolaus, Niklas', 'Angela, Angelika', 'Virginia', 'Anna', 'Malin, Malena', 'Daniel, Daniela', 'Alexander, Alexis', 'Lucia', 'Sten, Sixten', 'Gottfrid', 'Assar', 'Stig', 'Abraham', 'Isak', 'Israel, Moses', 'Tomas', 'Natanael, Jonatan', 'Adam', 'Eva', 'Juldagen', 'Stefan, Staffan', 'Johannes, Johan', 'Benjamin', 'Natalia, Natalie', 'Abel, Set', 'Sylvester'],
var ln =;
gadgets.util.registerOnLoadHandler(function() {
window.setInterval(update, 60*60*1000);
function add() {
google.calendar.addCalendar(ln.calid+'', ln.l10n.title);
function update() {
var today = document.getElementById('today');
var tomorrow = document.getElementById('tomorrow');
var day3 = document.getElementById('day3');
var day4 = document.getElementById('day4');
var addbutton = document.getElementById('addbutton');
var wikipedia = document.getElementById('wikipedia');
var website = document.getElementById('website');
var more = document.getElementById('more');
// Update l10n
// Get date
var jsDate = google.calendar.utils.getNow();
// Update wikipedia link
wikipedia.href = ln.wikiurl+'#'+ln.months[jsDate.getMonth()];
// Update dayTimer
var ttl = ((23-jsDate.getHours())*60*60+(59-jsDate.getMinutes())*60+(59-jsDate.getSeconds()))*1000+999-jsDate.getMilliseconds()+100;
dayTimer = setInterval(update, ttl);
// Update names
var getDate = function(d) {
return jsDate.getDate()+' '+ln.months[d.getMonth()].substring(0,3).toLowerCase()+': ';
var getName = function(d) {
return ln.names[d.getMonth()][d.getDate()-1];
today.appendChild(document.createTextNode(': '));
var bold = document.createElement('b');
tomorrow.appendChild(document.createTextNode(ln.l10n.tomorrow+': '));
[day3,day4].map(function(day) {
function toggle() {
var main = document.getElementById('main');
var more = document.getElementById('more');
var who = ( == 'none'); = (who?'none':'block'); = (who?'block':'none');
var about = document.getElementById('about');
function clear(el) {
while (el.firstChild) {
if(!,e){var f,d,a,b=Object(this),g=b.length>>>0;e&&(f=e);d=Array(g);for(a=0;a<g;){var c;a in b&&(c=b[a],,c,a,b),d[a]=c);a++}return d};
<a id="about" onclick="toggle()">»</a>
<div id="main">
<span id="today"></span><br/>
<span id="tomorrow"></span><br/>
<span id="day3"></span><br/>
<span id="day4"></span>
<div id="more" style="display:none;">
<a id="wikipedia" target="_blank"></a><br/>
<a id="website" target="_blank" href=""></a><br/>
<button id="addbutton" onclick="add()"></button>
-- Name days for Sweden (2013 års namnsdagslängd)
-- sqlite3 namedays-se.db ".read namedays-se.sql"
-- Days that are not name days (will have to be edited manually in .ics file):
-- Januari: 1
-- Februari: 2, 29
-- Mars: 25
-- Juni: 24
-- November: 1
-- December: 25
PRAGMA foreign_keys=OFF;
CREATE TABLE "namedays" (month int, day int, names text);
INSERT INTO "namedays" VALUES(1,1,'Nyårsdagen');
INSERT INTO "namedays" VALUES(1,2,'Svea');
INSERT INTO "namedays" VALUES(1,3,'Alfred, Alfrida');
INSERT INTO "namedays" VALUES(1,4,'Rut');
INSERT INTO "namedays" VALUES(1,5,'Hanna, Hannele');
INSERT INTO "namedays" VALUES(1,6,'Kasper, Melker, Baltsar');
INSERT INTO "namedays" VALUES(1,7,'August, Augusta');
INSERT INTO "namedays" VALUES(1,8,'Erland');
INSERT INTO "namedays" VALUES(1,9,'Gunnar, Gunder');
INSERT INTO "namedays" VALUES(1,10,'Sigurd, Sigbritt');
INSERT INTO "namedays" VALUES(1,11,'Jan, Jannike');
INSERT INTO "namedays" VALUES(1,12,'Frideborg, Fridolf');
INSERT INTO "namedays" VALUES(1,13,'Knut');
INSERT INTO "namedays" VALUES(1,14,'Felix, Felicia');
INSERT INTO "namedays" VALUES(1,15,'Laura, Lorentz');
INSERT INTO "namedays" VALUES(1,16,'Hjalmar, Helmer');
INSERT INTO "namedays" VALUES(1,17,'Anton, Tony');
INSERT INTO "namedays" VALUES(1,18,'Hilda, Hildur');
INSERT INTO "namedays" VALUES(1,19,'Henrik');
INSERT INTO "namedays" VALUES(1,20,'Fabian, Sebastian');
INSERT INTO "namedays" VALUES(1,21,'Agnes, Agneta');
INSERT INTO "namedays" VALUES(1,22,'Vincent, Viktor');
INSERT INTO "namedays" VALUES(1,23,'Frej, Freja');
INSERT INTO "namedays" VALUES(1,24,'Erika');
INSERT INTO "namedays" VALUES(1,25,'Paul, Pål');
INSERT INTO "namedays" VALUES(1,26,'Bodil, Boel');
INSERT INTO "namedays" VALUES(1,27,'Göte, Göta');
INSERT INTO "namedays" VALUES(1,28,'Karl, Karla');
INSERT INTO "namedays" VALUES(1,29,'Diana');
INSERT INTO "namedays" VALUES(1,30,'Gunilla, Gunhild');
INSERT INTO "namedays" VALUES(1,31,'Ivar, Joar');
INSERT INTO "namedays" VALUES(2,1,'Max, Maximilian');
INSERT INTO "namedays" VALUES(2,2,'Kyndelsmässodagen');
INSERT INTO "namedays" VALUES(2,3,'Disa, Hjördis');
INSERT INTO "namedays" VALUES(2,4,'Ansgar, Anselm');
INSERT INTO "namedays" VALUES(2,5,'Agata, Agda');
INSERT INTO "namedays" VALUES(2,6,'Dorotea, Doris');
INSERT INTO "namedays" VALUES(2,7,'Rikard, Dick');
INSERT INTO "namedays" VALUES(2,8,'Berta, Bert');
INSERT INTO "namedays" VALUES(2,9,'Fanny, Franciska');
INSERT INTO "namedays" VALUES(2,10,'Iris');
INSERT INTO "namedays" VALUES(2,11,'Yngve, Inge');
INSERT INTO "namedays" VALUES(2,12,'Evelina, Evy');
INSERT INTO "namedays" VALUES(2,13,'Agne, Ove');
INSERT INTO "namedays" VALUES(2,14,'Valentin');
INSERT INTO "namedays" VALUES(2,15,'Sigfrid');
INSERT INTO "namedays" VALUES(2,16,'Julia, Julius');
INSERT INTO "namedays" VALUES(2,17,'Alexandra, Sandra');
INSERT INTO "namedays" VALUES(2,18,'Frida, Fritiof');
INSERT INTO "namedays" VALUES(2,19,'Gabriella, Ella');
INSERT INTO "namedays" VALUES(2,20,'Vivianne');
INSERT INTO "namedays" VALUES(2,21,'Hilding');
INSERT INTO "namedays" VALUES(2,22,'Pia');
INSERT INTO "namedays" VALUES(2,23,'Torsten, Torun');
INSERT INTO "namedays" VALUES(2,24,'Mattias, Mats');
INSERT INTO "namedays" VALUES(2,25,'Sigvard, Sivert');
INSERT INTO "namedays" VALUES(2,26,'Torgny, Torkel');
INSERT INTO "namedays" VALUES(2,27,'Lage');
INSERT INTO "namedays" VALUES(2,28,'Maria');
INSERT INTO "namedays" VALUES(2,29,'Skottdagen');
INSERT INTO "namedays" VALUES(3,1,'Albin, Elvira');
INSERT INTO "namedays" VALUES(3,2,'Ernst, Erna');
INSERT INTO "namedays" VALUES(3,3,'Gunborg, Gunvor');
INSERT INTO "namedays" VALUES(3,4,'Adrian, Adriana');
INSERT INTO "namedays" VALUES(3,5,'Tora, Tove');
INSERT INTO "namedays" VALUES(3,6,'Ebba, Ebbe');
INSERT INTO "namedays" VALUES(3,7,'Camilla');
INSERT INTO "namedays" VALUES(3,8,'Siv');
INSERT INTO "namedays" VALUES(3,9,'Torbjörn, Torleif');
INSERT INTO "namedays" VALUES(3,10,'Edla, Ada');
INSERT INTO "namedays" VALUES(3,11,'Edvin, Egon');
INSERT INTO "namedays" VALUES(3,12,'Viktoria');
INSERT INTO "namedays" VALUES(3,13,'Greger');
INSERT INTO "namedays" VALUES(3,14,'Matilda, Maud');
INSERT INTO "namedays" VALUES(3,15,'Kristoffer, Christel');
INSERT INTO "namedays" VALUES(3,16,'Herbert, Gilbert');
INSERT INTO "namedays" VALUES(3,17,'Gertrud');
INSERT INTO "namedays" VALUES(3,18,'Edvard, Edmund');
INSERT INTO "namedays" VALUES(3,19,'Josef, Josefina');
INSERT INTO "namedays" VALUES(3,20,'Joakim, Kim');
INSERT INTO "namedays" VALUES(3,21,'Bengt');
INSERT INTO "namedays" VALUES(3,22,'Kennet, Kent');
INSERT INTO "namedays" VALUES(3,23,'Gerda, Gerd');
INSERT INTO "namedays" VALUES(3,24,'Gabriel, Rafael');
INSERT INTO "namedays" VALUES(3,25,'Marie bebådelsedag');
INSERT INTO "namedays" VALUES(3,26,'Emanuel');
INSERT INTO "namedays" VALUES(3,27,'Rudolf, Ralf');
INSERT INTO "namedays" VALUES(3,28,'Malkolm, Morgan');
INSERT INTO "namedays" VALUES(3,29,'Jonas, Jens');
INSERT INTO "namedays" VALUES(3,30,'Holger, Holmfrid');
INSERT INTO "namedays" VALUES(3,31,'Ester');
INSERT INTO "namedays" VALUES(4,1,'Harald, Hervor');
INSERT INTO "namedays" VALUES(4,2,'Gudmund, Ingemund');
INSERT INTO "namedays" VALUES(4,3,'Ferdinand, Nanna');
INSERT INTO "namedays" VALUES(4,4,'Marianne, Marlene');
INSERT INTO "namedays" VALUES(4,5,'Irene, Irja');
INSERT INTO "namedays" VALUES(4,6,'Vilhelm, William');
INSERT INTO "namedays" VALUES(4,7,'Irma, Irmelin');
INSERT INTO "namedays" VALUES(4,8,'Nadja, Tanja');
INSERT INTO "namedays" VALUES(4,9,'Otto, Ottilia');
INSERT INTO "namedays" VALUES(4,10,'Ingvar, Ingvor');
INSERT INTO "namedays" VALUES(4,11,'Ulf, Ylva');
INSERT INTO "namedays" VALUES(4,12,'Liv');
INSERT INTO "namedays" VALUES(4,13,'Artur, Douglas');
INSERT INTO "namedays" VALUES(4,14,'Tiburtius');
INSERT INTO "namedays" VALUES(4,15,'Olivia, Oliver');
INSERT INTO "namedays" VALUES(4,16,'Patrik, Patricia');
INSERT INTO "namedays" VALUES(4,17,'Elias, Elis');
INSERT INTO "namedays" VALUES(4,18,'Valdemar, Volmar');
INSERT INTO "namedays" VALUES(4,19,'Olaus, Ola');
INSERT INTO "namedays" VALUES(4,20,'Amalia, Amelie, Emelie');
INSERT INTO "namedays" VALUES(4,21,'Anneli, Annika');
INSERT INTO "namedays" VALUES(4,22,'Allan, Glenn');
INSERT INTO "namedays" VALUES(4,23,'Georg, Göran');
INSERT INTO "namedays" VALUES(4,24,'Vega');
INSERT INTO "namedays" VALUES(4,25,'Markus');
INSERT INTO "namedays" VALUES(4,26,'Teresia, Terese');
INSERT INTO "namedays" VALUES(4,27,'Engelbrekt');
INSERT INTO "namedays" VALUES(4,28,'Ture, Tyra');
INSERT INTO "namedays" VALUES(4,29,'Tyko');
INSERT INTO "namedays" VALUES(4,30,'Mariana');
INSERT INTO "namedays" VALUES(5,1,'Valborg');
INSERT INTO "namedays" VALUES(5,2,'Filip, Filippa');
INSERT INTO "namedays" VALUES(5,3,'John, Jane');
INSERT INTO "namedays" VALUES(5,4,'Monika, Mona');
INSERT INTO "namedays" VALUES(5,5,'Gotthard, Erhard');
INSERT INTO "namedays" VALUES(5,6,'Marit, Rita');
INSERT INTO "namedays" VALUES(5,7,'Carina, Carita');
INSERT INTO "namedays" VALUES(5,8,'Åke');
INSERT INTO "namedays" VALUES(5,9,'Reidar, Reidun');
INSERT INTO "namedays" VALUES(5,10,'Esbjörn, Styrbjörn');
INSERT INTO "namedays" VALUES(5,11,'Märta, Märit');
INSERT INTO "namedays" VALUES(5,12,'Charlotta, Lotta');
INSERT INTO "namedays" VALUES(5,13,'Linnea, Linn');
INSERT INTO "namedays" VALUES(5,14,'Halvard, Halvar');
INSERT INTO "namedays" VALUES(5,15,'Sofia, Sonja');
INSERT INTO "namedays" VALUES(5,16,'Ronald, Ronny');
INSERT INTO "namedays" VALUES(5,17,'Rebecka, Ruben');
INSERT INTO "namedays" VALUES(5,18,'Erik');
INSERT INTO "namedays" VALUES(5,19,'Maj, Majken');
INSERT INTO "namedays" VALUES(5,20,'Karolina, Carola');
INSERT INTO "namedays" VALUES(5,21,'Konstantin, Conny');
INSERT INTO "namedays" VALUES(5,22,'Hemming, Henning');
INSERT INTO "namedays" VALUES(5,23,'Desideria, Desirée');
INSERT INTO "namedays" VALUES(5,24,'Ivan, Vanja');
INSERT INTO "namedays" VALUES(5,25,'Urban');
INSERT INTO "namedays" VALUES(5,26,'Vilhelmina, Vilma');
INSERT INTO "namedays" VALUES(5,27,'Beda, Blenda');
INSERT INTO "namedays" VALUES(5,28,'Ingeborg, Borghild');
INSERT INTO "namedays" VALUES(5,29,'Yvonne, Jeanette');
INSERT INTO "namedays" VALUES(5,30,'Vera, Veronika');
INSERT INTO "namedays" VALUES(5,31,'Petronella, Pernilla');
INSERT INTO "namedays" VALUES(6,1,'Gun, Gunnel');
INSERT INTO "namedays" VALUES(6,2,'Rutger, Roger');
INSERT INTO "namedays" VALUES(6,3,'Ingemar, Gudmar');
INSERT INTO "namedays" VALUES(6,4,'Solbritt, Solveig');
INSERT INTO "namedays" VALUES(6,5,'Bo');
INSERT INTO "namedays" VALUES(6,6,'Gustav, Gösta');
INSERT INTO "namedays" VALUES(6,7,'Robert, Robin');
INSERT INTO "namedays" VALUES(6,8,'Eivor, Majvor');
INSERT INTO "namedays" VALUES(6,9,'Börje, Birger');
INSERT INTO "namedays" VALUES(6,10,'Svante, Boris');
INSERT INTO "namedays" VALUES(6,11,'Bertil, Berthold');
INSERT INTO "namedays" VALUES(6,12,'Eskil');
INSERT INTO "namedays" VALUES(6,13,'Aina, Aino');
INSERT INTO "namedays" VALUES(6,14,'Håkan, Hakon');
INSERT INTO "namedays" VALUES(6,15,'Margit, Margot');
INSERT INTO "namedays" VALUES(6,16,'Axel, Axelina');
INSERT INTO "namedays" VALUES(6,17,'Torborg, Torvald');
INSERT INTO "namedays" VALUES(6,18,'Björn, Bjarne');
INSERT INTO "namedays" VALUES(6,19,'Germund, Görel');
INSERT INTO "namedays" VALUES(6,20,'Linda');
INSERT INTO "namedays" VALUES(6,21,'Alf, Alvar');
INSERT INTO "namedays" VALUES(6,22,'Paulina, Paula');
INSERT INTO "namedays" VALUES(6,23,'Adolf, Alice');
INSERT INTO "namedays" VALUES(6,24,'Johannes Döparens dag');
INSERT INTO "namedays" VALUES(6,25,'David, Salomon');
INSERT INTO "namedays" VALUES(6,26,'Rakel, Lea');
INSERT INTO "namedays" VALUES(6,27,'Selma, Fingal');
INSERT INTO "namedays" VALUES(6,28,'Leo');
INSERT INTO "namedays" VALUES(6,29,'Peter, Petra');
INSERT INTO "namedays" VALUES(6,30,'Elof, Leif');
INSERT INTO "namedays" VALUES(7,1,'Aron, Mirjam');
INSERT INTO "namedays" VALUES(7,2,'Rosa, Rosita');
INSERT INTO "namedays" VALUES(7,3,'Aurora');
INSERT INTO "namedays" VALUES(7,4,'Ulrika, Ulla');
INSERT INTO "namedays" VALUES(7,5,'Laila, Ritva');
INSERT INTO "namedays" VALUES(7,6,'Esaias, Jessika');
INSERT INTO "namedays" VALUES(7,7,'Klas');
INSERT INTO "namedays" VALUES(7,8,'Kjell');
INSERT INTO "namedays" VALUES(7,9,'Jörgen, Örjan');
INSERT INTO "namedays" VALUES(7,10,'André, Andrea');
INSERT INTO "namedays" VALUES(7,11,'Eleonora, Ellinor');
INSERT INTO "namedays" VALUES(7,12,'Herman, Hermine');
INSERT INTO "namedays" VALUES(7,13,'Joel, Judit');
INSERT INTO "namedays" VALUES(7,14,'Folke');
INSERT INTO "namedays" VALUES(7,15,'Ragnhild, Ragnvald');
INSERT INTO "namedays" VALUES(7,16,'Reinhold, Reine');
INSERT INTO "namedays" VALUES(7,17,'Bruno');
INSERT INTO "namedays" VALUES(7,18,'Fredrik, Fritz');
INSERT INTO "namedays" VALUES(7,19,'Sara');
INSERT INTO "namedays" VALUES(7,20,'Margareta, Greta');
INSERT INTO "namedays" VALUES(7,21,'Johanna');
INSERT INTO "namedays" VALUES(7,22,'Magdalena, Madeleine');
INSERT INTO "namedays" VALUES(7,23,'Emma');
INSERT INTO "namedays" VALUES(7,24,'Kristina, Kerstin');
INSERT INTO "namedays" VALUES(7,25,'Jakob');
INSERT INTO "namedays" VALUES(7,26,'Jesper');
INSERT INTO "namedays" VALUES(7,27,'Marta');
INSERT INTO "namedays" VALUES(7,28,'Botvid, Seved');
INSERT INTO "namedays" VALUES(7,29,'Olof');
INSERT INTO "namedays" VALUES(7,30,'Algot');
INSERT INTO "namedays" VALUES(7,31,'Helena, Elin');
INSERT INTO "namedays" VALUES(8,1,'Per');
INSERT INTO "namedays" VALUES(8,2,'Karin, Kajsa');
INSERT INTO "namedays" VALUES(8,3,'Tage');
INSERT INTO "namedays" VALUES(8,4,'Arne, Arnold');
INSERT INTO "namedays" VALUES(8,5,'Ulrik, Alrik');
INSERT INTO "namedays" VALUES(8,6,'Alfons, Inez');
INSERT INTO "namedays" VALUES(8,7,'Dennis, Denise');
INSERT INTO "namedays" VALUES(8,8,'Silvia, Sylvia');
INSERT INTO "namedays" VALUES(8,9,'Roland');
INSERT INTO "namedays" VALUES(8,10,'Lars');
INSERT INTO "namedays" VALUES(8,11,'Susanna');
INSERT INTO "namedays" VALUES(8,12,'Klara');
INSERT INTO "namedays" VALUES(8,13,'Kaj');
INSERT INTO "namedays" VALUES(8,14,'Uno');
INSERT INTO "namedays" VALUES(8,15,'Stella, Estelle');
INSERT INTO "namedays" VALUES(8,16,'Brynolf');
INSERT INTO "namedays" VALUES(8,17,'Verner, Valter');
INSERT INTO "namedays" VALUES(8,18,'Ellen, Lena');
INSERT INTO "namedays" VALUES(8,19,'Magnus, Måns');
INSERT INTO "namedays" VALUES(8,20,'Bernhard, Bernt');
INSERT INTO "namedays" VALUES(8,21,'Jon, Jonna');
INSERT INTO "namedays" VALUES(8,22,'Henrietta, Henrika');
INSERT INTO "namedays" VALUES(8,23,'Signe, Signhild');
INSERT INTO "namedays" VALUES(8,24,'Bartolomeus');
INSERT INTO "namedays" VALUES(8,25,'Lovisa, Louise');
INSERT INTO "namedays" VALUES(8,26,'Östen');
INSERT INTO "namedays" VALUES(8,27,'Rolf, Raoul');
INSERT INTO "namedays" VALUES(8,28,'Fatima, Leila');
INSERT INTO "namedays" VALUES(8,29,'Hans, Hampus');
INSERT INTO "namedays" VALUES(8,30,'Albert, Albertina');
INSERT INTO "namedays" VALUES(8,31,'Arvid, Vidar');
INSERT INTO "namedays" VALUES(9,1,'Sam, Samuel');
INSERT INTO "namedays" VALUES(9,2,'Justus, Justina');
INSERT INTO "namedays" VALUES(9,3,'Alfhild, Alva');
INSERT INTO "namedays" VALUES(9,4,'Gisela');
INSERT INTO "namedays" VALUES(9,5,'Adela, Heidi');
INSERT INTO "namedays" VALUES(9,6,'Lilian, Lilly');
INSERT INTO "namedays" VALUES(9,7,'Kevin, Roy');
INSERT INTO "namedays" VALUES(9,8,'Alma, Hulda');
INSERT INTO "namedays" VALUES(9,9,'Anita, Annette');
INSERT INTO "namedays" VALUES(9,10,'Tord, Turid');
INSERT INTO "namedays" VALUES(9,11,'Dagny, Helny');
INSERT INTO "namedays" VALUES(9,12,'Åsa, Åslög');
INSERT INTO "namedays" VALUES(9,13,'Sture');
INSERT INTO "namedays" VALUES(9,14,'Ida');
INSERT INTO "namedays" VALUES(9,15,'Sigrid, Siri');
INSERT INTO "namedays" VALUES(9,16,'Dag, Daga');
INSERT INTO "namedays" VALUES(9,17,'Hildegard, Magnhild');
INSERT INTO "namedays" VALUES(9,18,'Orvar');
INSERT INTO "namedays" VALUES(9,19,'Fredrika');
INSERT INTO "namedays" VALUES(9,20,'Elise, Lisa');
INSERT INTO "namedays" VALUES(9,21,'Matteus');
INSERT INTO "namedays" VALUES(9,22,'Maurits, Moritz');
INSERT INTO "namedays" VALUES(9,23,'Tekla, Tea');
INSERT INTO "namedays" VALUES(9,24,'Gerhard, Gert');
INSERT INTO "namedays" VALUES(9,25,'Tryggve');
INSERT INTO "namedays" VALUES(9,26,'Enar, Einar');
INSERT INTO "namedays" VALUES(9,27,'Dagmar, Rigmor');
INSERT INTO "namedays" VALUES(9,28,'Lennart, Leonard');
INSERT INTO "namedays" VALUES(9,29,'Mikael, Mikaela');
INSERT INTO "namedays" VALUES(9,30,'Helge');
INSERT INTO "namedays" VALUES(10,1,'Ragnar, Ragna');
INSERT INTO "namedays" VALUES(10,2,'Ludvig, Love');
INSERT INTO "namedays" VALUES(10,3,'Evald, Osvald');
INSERT INTO "namedays" VALUES(10,4,'Frans, Frank');
INSERT INTO "namedays" VALUES(10,5,'Bror');
INSERT INTO "namedays" VALUES(10,6,'Jenny, Jennifer');
INSERT INTO "namedays" VALUES(10,7,'Birgitta, Britta');
INSERT INTO "namedays" VALUES(10,8,'Nils');
INSERT INTO "namedays" VALUES(10,9,'Ingrid, Inger');
INSERT INTO "namedays" VALUES(10,10,'Harry, Harriet');
INSERT INTO "namedays" VALUES(10,11,'Erling, Jarl');
INSERT INTO "namedays" VALUES(10,12,'Valfrid, Manfred');
INSERT INTO "namedays" VALUES(10,13,'Berit, Birgit');
INSERT INTO "namedays" VALUES(10,14,'Stellan');
INSERT INTO "namedays" VALUES(10,15,'Hedvig, Hillevi');
INSERT INTO "namedays" VALUES(10,16,'Finn');
INSERT INTO "namedays" VALUES(10,17,'Antonia, Toini');
INSERT INTO "namedays" VALUES(10,18,'Lukas');
INSERT INTO "namedays" VALUES(10,19,'Tore, Tor');
INSERT INTO "namedays" VALUES(10,20,'Sibylla');
INSERT INTO "namedays" VALUES(10,21,'Ursula, Yrsa');
INSERT INTO "namedays" VALUES(10,22,'Marika, Marita');
INSERT INTO "namedays" VALUES(10,23,'Severin, Sören');
INSERT INTO "namedays" VALUES(10,24,'Evert, Eilert');
INSERT INTO "namedays" VALUES(10,25,'Inga, Ingalill');
INSERT INTO "namedays" VALUES(10,26,'Amanda, Rasmus');
INSERT INTO "namedays" VALUES(10,27,'Sabina');
INSERT INTO "namedays" VALUES(10,28,'Simon, Simone');
INSERT INTO "namedays" VALUES(10,29,'Viola');
INSERT INTO "namedays" VALUES(10,30,'Elsa, Isabella');
INSERT INTO "namedays" VALUES(10,31,'Edit, Edgar');
INSERT INTO "namedays" VALUES(11,1,'Allhelgonadagen');
INSERT INTO "namedays" VALUES(11,2,'Tobias');
INSERT INTO "namedays" VALUES(11,3,'Hubert, Hugo');
INSERT INTO "namedays" VALUES(11,4,'Sverker');
INSERT INTO "namedays" VALUES(11,5,'Eugen, Eugenia');
INSERT INTO "namedays" VALUES(11,6,'Gustav Adolf');
INSERT INTO "namedays" VALUES(11,7,'Ingegerd, Ingela');
INSERT INTO "namedays" VALUES(11,8,'Vendela');
INSERT INTO "namedays" VALUES(11,9,'Teodor, Teodora');
INSERT INTO "namedays" VALUES(11,10,'Martin, Martina');
INSERT INTO "namedays" VALUES(11,11,'Mårten');
INSERT INTO "namedays" VALUES(11,12,'Konrad, Kurt');
INSERT INTO "namedays" VALUES(11,13,'Kristian, Krister');
INSERT INTO "namedays" VALUES(11,14,'Emil, Emilia');
INSERT INTO "namedays" VALUES(11,15,'Leopold');
INSERT INTO "namedays" VALUES(11,16,'Vibeke, Viveka');
INSERT INTO "namedays" VALUES(11,17,'Naemi, Naima');
INSERT INTO "namedays" VALUES(11,18,'Lillemor, Moa');
INSERT INTO "namedays" VALUES(11,19,'Elisabet, Lisbet');
INSERT INTO "namedays" VALUES(11,20,'Pontus, Marina');
INSERT INTO "namedays" VALUES(11,21,'Helga, Olga');
INSERT INTO "namedays" VALUES(11,22,'Cecilia, Sissela');
INSERT INTO "namedays" VALUES(11,23,'Klemens');
INSERT INTO "namedays" VALUES(11,24,'Gudrun, Rune');
INSERT INTO "namedays" VALUES(11,25,'Katarina, Katja');
INSERT INTO "namedays" VALUES(11,26,'Linus');
INSERT INTO "namedays" VALUES(11,27,'Astrid, Asta');
INSERT INTO "namedays" VALUES(11,28,'Malte');
INSERT INTO "namedays" VALUES(11,29,'Sune');
INSERT INTO "namedays" VALUES(11,30,'Andreas, Anders');
INSERT INTO "namedays" VALUES(12,1,'Oskar, Ossian');
INSERT INTO "namedays" VALUES(12,2,'Beata, Beatrice');
INSERT INTO "namedays" VALUES(12,3,'Lydia');
INSERT INTO "namedays" VALUES(12,4,'Barbara, Barbro');
INSERT INTO "namedays" VALUES(12,5,'Sven');
INSERT INTO "namedays" VALUES(12,6,'Nikolaus, Niklas');
INSERT INTO "namedays" VALUES(12,7,'Angela, Angelika');
INSERT INTO "namedays" VALUES(12,8,'Virginia');
INSERT INTO "namedays" VALUES(12,9,'Anna');
INSERT INTO "namedays" VALUES(12,10,'Malin, Malena');
INSERT INTO "namedays" VALUES(12,11,'Daniel, Daniela');
INSERT INTO "namedays" VALUES(12,12,'Alexander, Alexis');
INSERT INTO "namedays" VALUES(12,13,'Lucia');
INSERT INTO "namedays" VALUES(12,14,'Sten, Sixten');
INSERT INTO "namedays" VALUES(12,15,'Gottfrid');
INSERT INTO "namedays" VALUES(12,16,'Assar');
INSERT INTO "namedays" VALUES(12,17,'Stig');
INSERT INTO "namedays" VALUES(12,18,'Abraham');
INSERT INTO "namedays" VALUES(12,19,'Isak');
INSERT INTO "namedays" VALUES(12,20,'Israel, Moses');
INSERT INTO "namedays" VALUES(12,21,'Tomas');
INSERT INTO "namedays" VALUES(12,22,'Natanael, Jonatan');
INSERT INTO "namedays" VALUES(12,23,'Adam');
INSERT INTO "namedays" VALUES(12,24,'Eva');
INSERT INTO "namedays" VALUES(12,25,'Juldagen');
INSERT INTO "namedays" VALUES(12,26,'Stefan, Staffan');
INSERT INTO "namedays" VALUES(12,27,'Johannes, Johan');
INSERT INTO "namedays" VALUES(12,28,'Benjamin');
INSERT INTO "namedays" VALUES(12,29,'Natalia, Natalie');
INSERT INTO "namedays" VALUES(12,30,'Abel, Set');
INSERT INTO "namedays" VALUES(12,31,'Sylvester');
import datetime
year = int(input("Enter year: "))
fn = "namedays-"+str(year)+".ics"
months = ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"]
namedays = [
["Nyårsdagen", "Svea", "Alfred, Alfrida", "Rut", "Hanna, Hannele", "Kasper, Melker, Baltsar", "August, Augusta", "Erland", "Gunnar, Gunder", "Sigurd, Sigbritt", "Jan, Jannike", "Frideborg, Fridolf", "Knut", "Felix, Felicia", "Laura, Lorentz", "Hjalmar, Helmer", "Anton, Tony", "Hilda, Hildur", "Henrik", "Fabian, Sebastian", "Agnes, Agneta", "Vincent, Viktor", "Frej, Freja", "Erika", "Paul, Pål", "Bodil, Boel", "Göte, Göta", "Karl, Karla", "Diana", "Gunilla, Gunhild", "Ivar, Joar"],
["Max, Maximilian", "Kyndelsmässodagen", "Disa, Hjördis", "Ansgar, Anselm", "Agata, Agda", "Dorotea, Doris", "Rikard, Dick", "Berta, Bert", "Fanny, Franciska", "Iris", "Yngve, Inge", "Evelina, Evy", "Agne, Ove", "Valentin", "Sigfrid", "Julia, Julius", "Alexandra, Sandra", "Frida, Fritiof", "Gabriella, Ella", "Vivianne", "Hilding", "Pia", "Torsten, Torun", "Mattias, Mats", "Sigvard, Sivert", "Torgny, Torkel", "Lage", "Maria", "Skottdagen"],
["Albin, Elvira", "Ernst, Erna", "Gunborg, Gunvor", "Adrian, Adriana", "Tora, Tove", "Ebba, Ebbe", "Camilla", "Siv, Saga", "Torbjörn, Torleif", "Edla, Ada", "Edvin, Egon", "Viktoria", "Greger", "Matilda, Maud", "Kristoffer, Christel", "Herbert, Gilbert", "Gertrud", "Edvard, Edmund", "Josef, Josefina", "Joakim, Kim", "Bengt", "Kennet, Kent", "Gerda, Gerd", "Gabriel, Rafael", "Marie bebådelsedag", "Emanuel", "Rudolf, Ralf", "Malkolm, Morgan", "Jonas, Jens", "Holger, Holmfrid", "Ester"],
["Harald, Hervor", "Gudmund, Ingemund", "Ferdinand, Nanna", "Marianne, Marlene", "Irene, Irja", "Vilhelm, William", "Irma, Irmelin", "Nadja, Tanja", "Otto, Ottilia", "Ingvar, Ingvor", "Ulf, Ylva", "Liv", "Artur, Douglas", "Tiburtius", "Olivia, Oliver", "Patrik, Patricia", "Elias, Elis", "Valdemar, Volmar", "Olaus, Ola", "Amalia, Amelie", "Anneli, Annika", "Allan, Glenn", "Georg, Göran", "Vega", "Markus", "Teresia, Terese", "Engelbrekt", "Ture, Tyra", "Tyko", "Mariana"],
["Valborg", "Filip, Filippa", "John, Jane", "Monika, Mona", "Gotthard, Erhard", "Marit, Rita", "Carina, Carita", "Åke", "Reidar, Reidun", "Esbjörn, Styrbjörn", "Märta, Märit", "Charlotta, Lotta", "Linnea, Linn", "Halvard, Halvar", "Sofia, Sonja", "Ronald, Ronny", "Rebecka, Ruben", "Erik", "Maj, Majken", "Karolina, Carola", "Konstantin, Conny", "Hemming, Henning", "Desideria, Desirée", "Ivan, Vanja", "Urban", "Vilhelmina, Vilma", "Beda, Blenda", "Ingeborg, Borghild", "Yvonne, Jeanette", "Vera, Veronika", "Petronella, Pernilla"],
["Gun, Gunnel", "Rutger, Roger", "Ingemar, Gudmar", "Solbritt, Solveig", "Bo", "Gustav, Gösta", "Robert, Robin", "Eivor, Majvor", "Börje, Birger", "Svante, Boris", "Bertil, Berthold", "Eskil", "Aina, Aino", "Håkan, Hakon", "Margit, Margot", "Axel, Axelina", "Torborg, Torvald", "Björn, Bjarne", "Germund, Görel", "Linda", "Alf, Alvar", "Paulina, Paula", "Adolf, Alice", "Johannes Döparens dag", "David, Salomon", "Rakel, Lea", "Selma, Fingal", "Leo", "Peter, Petra", "Elof, Leif"],
["Aron, Mirjam", "Rosa, Rosita", "Aurora", "Ulrika, Ulla", "Laila, Ritva", "Esaias, Jessika", "Klas", "Kjell", "Jörgen, Örjan", "André, Andrea", "Eleonora, Ellinor", "Herman, Hermine", "Joel, Judit", "Folke", "Ragnhild, Ragnvald", "Reinhold, Reine", "Bruno", "Fredrik, Fritz", "Sara", "Margareta, Greta", "Johanna", "Magdalena, Madeleine", "Emma, Emmy", "Kristina, Kerstin", "Jakob", "Jesper, Jasmine", "Marta", "Botvid, Seved", "Olof", "Algot", "Helena, Elin"],
["Per", "Karin, Kajsa", "Tage", "Arne, Arnold", "Ulrik, Alrik", "Alfons, Inez", "Dennis, Denise", "Silvia, Sylvia", "Roland", "Lars", "Susanna", "Klara", "Kaj", "Uno", "Stella, Estelle", "Brynolf", "Verner, Valter", "Ellen, Lena", "Magnus, Måns", "Bernhard, Bernt", "Jon, Jonna", "Henrietta, Henrika", "Signe, Signhild", "Bartolomeus", "Lovisa, Louise", "Östen", "Rolf, Raoul", "Fatima, Leila", "Hans, Hampus", "Albert, Albertina", "Arvid, Vidar"],
["Samuel, Sam", "Justus, Justina", "Alfhild, Alva", "Gisela", "Adela, Heidi", "Lilian, Lilly", "Kevin, Roy", "Alma, Hulda", "Anita, Annette", "Tord, Turid", "Dagny, Helny", "Åsa, Åslög", "Sture", "Ida, Ronja", "Sigrid, Siri", "Dag, Daga", "Hildegard, Magnhild", "Orvar", "Fredrika", "Elise, Lisa", "Matteus", "Maurits, Moritz", "Tekla, Tea", "Gerhard, Gert", "Tryggve", "Enar, Einar", "Dagmar, Rigmor", "Lennart, Leonard", "Mikael, Mikaela", "Helge"],
["Ragnar, Ragna", "Ludvig, Love", "Evald, Osvald", "Frans, Frank", "Bror", "Jenny, Jennifer", "Birgitta, Britta", "Nils", "Ingrid, Inger", "Harry, Harriet", "Erling, Jarl", "Valfrid, Manfred", "Berit, Birgit", "Stellan", "Hedvig, Hillevi", "Finn", "Antonia, Toini", "Lukas", "Tore, Tor", "Sibylla", "Ursula, Yrsa", "Marika, Marita", "Severin, Sören", "Evert, Eilert", "Inga, Ingalill", "Amanda, Rasmus", "Sabina", "Simon, Simone", "Viola", "Elsa, Isabella", "Edit, Edgar"],
["Allhelgonadagen", "Tobias", "Hubert, Hugo", "Sverker", "Eugen, Eugenia", "Gustav Adolf", "Ingegerd, Ingela", "Vendela", "Teodor, Teodora", "Martin, Martina", "Mårten", "Konrad, Kurt", "Kristian, Krister", "Emil, Emilia", "Leopold", "Vibeke, Viveka", "Naemi, Naima", "Lillemor, Moa", "Elisabet, Lisbet", "Pontus, Marina", "Helga, Olga", "Cecilia, Sissela", "Klemens", "Gudrun, Rune", "Katarina, Katja", "Linus", "Astrid, Asta", "Malte", "Sune", "Andreas, Anders"],
["Oskar, Ossian", "Beata, Beatrice", "Lydia", "Barbara, Barbro", "Sven", "Nikolaus, Niklas", "Angela, Angelika", "Virginia", "Anna", "Malin, Malena", "Daniel, Daniela", "Alexander, Alexis", "Lucia", "Sten, Sixten", "Gottfrid", "Assar", "Stig", "Abraham", "Isak", "Israel, Moses", "Tomas", "Natanael, Jonatan", "Adam", "Eva", "Juldagen", "Stefan, Staffan", "Johannes, Johan", "Benjamin", "Natalia, Natalie", "Abel, Set", "Sylvester"],
if year >= 2022:
namedays[0][18] += ", Henry"
namedays[1][27] += ", Maja"
namedays[2][11] += ", Regina"
namedays[2][30] += ", Noa"
namedays[6][28] += ", Olle"
namedays[10][1] += ", Tim"
namedays[11][2] += ", Cornelia"
print("Writing "+fn)
f = open(fn, "wb")
"\n", "UTF-8"))
dt =, 1, 1)
while dt.year == year:
summary = namedays[dt.month-1][]+" – "+str(" "+months[dt.month-1].lower()
dtstart = dt.strftime("%Y%m%d")
dt += datetime.timedelta(days=1)
dtend = dt.strftime("%Y%m%d")
"\n", "UTF-8"))
f.write(bytes("END:VCALENDAR\n", "UTF-8"))
Display the source blob
Display the rendered blob
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?xml version="1.0" encoding="utf-8"?>
<ModulePrefs title="Week Numbers" title_url="" description="Displays week numbers." height="80" author="Stefan Sundin">
<Require feature="google.calendar-0.5" />
<Optional feature="dynamic-height"/>
<Content type="html">
<!DOCTYPE html>
<style type="text/css">
body {
margin: 3px;
font-size: small;
overflow: hidden;
background: white;
#about_container {
margin: 4px;
float: right;
#about_container a {
text-decoration: none;
#more {
margin: 10px 0;
text-align: center;
<script type="text/javascript">
var dayTimer;
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
function preferenceCallback(prefs) {
var startdow = parseInt(prefs.startdow);
if (startdow == 0 || startdow == 1) {
document.getElementById("dow").value = startdow;
gadgets.util.registerOnLoadHandler(function() {
window.setInterval(update, 60*60*1000);
function add() {
var dow = document.getElementById("dow").value;
var days = {0:"Sundays", 1:"Mondays"};
var calendars = {0:"d8u7iiljjpfibev3cd8emgau78", 1:"g0k1sv1gsdief8q28kvek83ps4"};
google.calendar.addCalendar(calendars[dow]+"", "Week Numbers ("+days[dow]+")");
function update() {
var now = document.getElementById("now");
var week2 = document.getElementById("week2");
var week3 = document.getElementById("week3");
var week4 = document.getElementById("week4");
// Get date
var jsDate = google.calendar.utils.getNow();
// Update dayTimer
var ttl = ((23-jsDate.getHours())*60*60+(59-jsDate.getMinutes())*60+(59-jsDate.getSeconds()))*1000+999-jsDate.getMilliseconds()+100;
dayTimer = setInterval(update, ttl);
// Update weeks
var week = jsDate.getISOWeek();
now.appendChild(document.createTextNode("Week "+week));
while (jsDate.getISOWeek() == week) {
week2.appendChild(document.createTextNode(months[jsDate.getMonth()]+" "+jsDate.getDate()+": "));
week2.appendChild(document.createTextNode("Week "+jsDate.getISOWeek()));
week3.appendChild(document.createTextNode(months[jsDate.getMonth()]+" "+jsDate.getDate()+": "));
week3.appendChild(document.createTextNode("Week "+jsDate.getISOWeek()));
week4.appendChild(document.createTextNode(months[jsDate.getMonth()]+" "+jsDate.getDate()+": "));
week4.appendChild(document.createTextNode("Week "+jsDate.getISOWeek()));
function more() {
var more = document.getElementById("more"); = ("none")?"block":"none";
var about = document.getElementById("about");
// Keep the gadget responsive
function clear(el) {
while (el.firstChild) {
Date.prototype.getISOWeek = function () {
var dowOffset = 1;
var newYear = new Date(this.getFullYear(),0,1);
var day = newYear.getDay()-dowOffset;
day = (day>=0?day:day+7);
var daynum = Math.floor((this.getTime()-newYear.getTime()-(this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000)+1;
var weeknum;
if (day < 4) {
weeknum = Math.floor((daynum+day-1)/7)+1;
if (weeknum > 52) {
nYear = new Date(this.getFullYear()+1,0,1);
nday = nYear.getDay()-dowOffset;
nday = (nday>=0?nday:nday+7);
weeknum = (nday<4?1:53);
else {
weeknum = Math.floor((daynum+day-1)/7);
return weeknum;
Now: <b id="now"></b><br />
<span id="week2"></span><br />
<span id="week3"></span><br />
<div id="about_container"><a id="about" onclick="more()" href="#">»</a></div>
<span id="week4"></span><br />
<div id="more" style="display:none;">
<select id="dow">
<option value="1">Mondays</option>
<option value="0">Sundays</option>
</select><br />
<button id="addbutton" onclick="add()">Add to calendar</button><br />
<a id="website" target="_blank" href="">Go to website</a><br />
<br />
Note: <a target="_blank" href="">ISO Weeks</a>.
Copy link

I was wondering if you could please include some instructions for compiling, and running/installing the code?
I'm trying to modify the code so that I can use it to mark the week number of my academic semester instead of the week number of the year.
Thank you for your time,

Copy link

Oh wow.. I don't really remember. This stuff is kinda useless now that Google Calendar no longer supports the icon feature. It just displays as regular events now. I don't think this is very useful at all anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment