Module:Birthday

local p = {} D = {} J = {} T = {} function BirthdayInsert(Date, Japanese, Transliterated) table.insert(D, Date) table.insert(J, Japanese) table.insert(T, Transliterated) end --When adding, do so in the right place. It's first ordered by day, then within days by years oldest to newest. --This way it's already in an order best for most of the birthday functions, and no sorting needs to be programmed in. BirthdayInsert('2002-01-06', '梁川奈々美', 'Yanagawa Nanami') BirthdayInsert('1995-01-07', '佐藤綾乃', 'Sato Ayano') BirthdayInsert('1997-01-07', '石田亜佑美', 'Ishida Ayumi') BirthdayInsert('1988-01-10', '吳思璇', 'Wu Si Xuan') BirthdayInsert('1988-01-11', 'ジュンジュン', 'Junjun') BirthdayInsert('1993-01-12', '光井愛佳', 'Mitsui Aika') BirthdayInsert('1999-01-14', '茂木美奈実', 'Mogi Minami') BirthdayInsert('1994-01-16', '邱翠玲', 'Qiu Cui Ling') BirthdayInsert('1985-01-19', '石川梨華', 'Ishikawa Rika') BirthdayInsert('1986-01-19', '牧野由依', 'Makino Yui') BirthdayInsert('1983-01-20', '矢口真里', 'Yaguchi Mari') BirthdayInsert('1984-01-27', '平野智美', 'Hirano Tomomi') BirthdayInsert('1977-01-30', '小林梓', 'Kobayashi Azusa') BirthdayInsert('1992-01-31', '武藤水華', 'Muto Mika') BirthdayInsert('2001-02-02', '牧野真莉愛', 'Makino Maria') BirthdayInsert('1994-02-05', '中島早貴', 'Nakajima Saki') BirthdayInsert('1981-02-06', '戸田鈴音', 'Toda Rinne') BirthdayInsert('1983-02-07', 'レフア・サンボ', 'Lehua Sandbo') BirthdayInsert('1988-02-07', '加護亜依', 'Kago Ai') BirthdayInsert('1992-02-07', '矢島舞美', 'Yajima Maimi') BirthdayInsert('1996-02-07', '萩原舞', 'Hagiwara Mai') BirthdayInsert('1985-02-09', '深谷愛', 'Fukaya Ai') BirthdayInsert('1991-02-10', '曾德萍', 'Ceng De Ping') BirthdayInsert('2000-02-10', '野村みな美', 'Nomura Minami') BirthdayInsert('2002-02-10', '小関舞', 'Ozeki Mai') BirthdayInsert('1987-02-12', '斉藤美海', 'Saito Miuna') BirthdayInsert('1977-02-15', '小湊美和', 'Kominato Miwa') BirthdayInsert('1989-02-15', '永井沙紀', 'Nagai Saki') BirthdayInsert('1999-02-15', '尾形春水', 'Ogata Haruna') BirthdayInsert('2000-02-19', '森戸知沙希', 'Morito Chisaki') BirthdayInsert('1984-02-22', '柴田あゆみ', 'Shibata Ayumi') BirthdayInsert('2001-02-22', '横山玲奈', 'Yokoyama Reina') BirthdayInsert('1982-02-25', '大谷雅恵', 'Otani Masae') BirthdayInsert('1999-02-25', '一岡怜奈', 'Ichioka Reina') BirthdayInsert('1980-02-26', '石井里佳', 'Ishii Rika') BirthdayInsert('1985-02-26', '藤本美貴', 'Fujimoto Miki') BirthdayInsert('2004-02-28', '岡本帆乃花', 'Okamoto Honoka') BirthdayInsert('1982-03-02', '大木衣吹', 'Oki Ibuki') BirthdayInsert('1981-03-03', '村田めぐみ', 'Murata Megumi') BirthdayInsert('1999-03-04', '藤井梨央', 'Fujii Rio') BirthdayInsert('1990-03-06', '菅原佳奈枝', 'Sugawara Kanae') BirthdayInsert('1992-03-06', '嗣永桃子', 'Tsugunaga Momoko') BirthdayInsert('2002-03-07', '羽賀朱音', 'Haga Akane') BirthdayInsert('1978-03-08', '荒井紗紀', 'Arai Saki') BirthdayInsert('2001-03-08', '和田桜子', 'Wada Sakurako') BirthdayInsert('1991-03-11', 'リンリン', 'Linlin') BirthdayInsert('1995-03-12', '福田花音', 'Fukuda Kanon') BirthdayInsert('1999-03-12', '小田さくら', 'Oda Sakura') BirthdayInsert('1974-03-13', '稲葉貴子', 'Inaba Atsuko') BirthdayInsert('1999-03-14', '横川夢衣', 'Yokogawa Yumei') BirthdayInsert('1993-03-15', '岡田ロビン翔子', 'Okada Robin Shoko') BirthdayInsert('1976-03-18', '本多ルル', 'Honda Ruru') BirthdayInsert('1999-03-19', '高瀬くるみ', 'Takase Kurumi') BirthdayInsert('1999-03-26', '相川茉穂', 'Aikawa Maho') BirthdayInsert('2000-03-27', '小川麗奈', 'Ogawa Rena') BirthdayInsert('1984-03-29', '里田まい', 'Satoda Mai') BirthdayInsert('2003-03-29', '児玉咲子', 'Kodama Sakiko') BirthdayInsert('1968-04-01', '渡部チェル', 'Watanabe Cher') BirthdayInsert('2000-04-01', '岸本ゆめの', 'Kishimoto Yumeno') BirthdayInsert('1994-04-02', '宮崎由加', 'Miyazaki Yuka') BirthdayInsert('1992-04-03', '中山菜々', 'Nakayama Nana') BirthdayInsert('1998-04-03', '大塚愛菜', 'Otsuka Aina') BirthdayInsert('1994-04-04', '菅谷梨沙子', 'Sugaya Risako') BirthdayInsert('1979-04-06', '平家 みちよ', 'Heike Michiyo') BirthdayInsert('1998-04-06', '勝田里奈', 'Katsuta Rina') BirthdayInsert('1991-04-11', '真野恵里菜', 'Mano Erina') BirthdayInsert('1985-04-12', '吉澤ひとみ', 'Yoshizawa Hitomi') BirthdayInsert('1994-04-12', '鈴木愛理', 'Suzuki Airi') BirthdayInsert('1983-04-15', 'エイプリル・ババラン', 'April Barbaran') BirthdayInsert('1992-04-15', '須磨愛', 'Suma Ai') BirthdayInsert('1990-04-16', '青木英里奈', 'Aoki Erina') BirthdayInsert('2004-04-19', '佐藤光', 'Sato Hikari') BirthdayInsert('2004-04-20', '石栗奏美', 'Ishiguri Kanami') BirthdayInsert('1997-04-21', '高木紗友希', 'Takagi Sayuki') BirthdayInsert('1993-04-23', '尾野里紗', 'Ono Risa') BirthdayInsert('2004-04-23', '河野みのり', 'Kawano Minori') BirthdayInsert('1991-04-25', '田中杏里', 'Tanaka Anri') BirthdayInsert('2000-04-26', '浜浦彩乃', 'Hamaura Ayano') BirthdayInsert('1983-04-28', '심순민', 'Shim Soon Min') BirthdayInsert('2001-04-28', '竹村未羽', 'Takemura Miu') BirthdayInsert('1991-04-29', '大瀬楓', 'Ohse Kaede') BirthdayInsert('2003-04-29', '吉田真理恵', 'Yoshida Marie') BirthdayInsert('1991-04-30', '仙石みなみ', 'Sengoku Minami') BirthdayInsert('2004-04-30', '米村姫良々', 'Yonemura Kirara') BirthdayInsert('1992-05-01', '吉川友', 'Kikkawa Yuu') BirthdayInsert('1987-05-07', '紺野あさ美', 'Konno Asami') BirthdayInsert('1997-05-07', '前田彩里', 'Maeda Irori') BirthdayInsert('1999-05-07', '佐藤優樹', 'Sato Masaki') BirthdayInsert('2001-05-07', '段原瑠々', 'Danbara Ruru') BirthdayInsert('2002-05-10', '船木結', 'Funaki Musubu') BirthdayInsert('1978-05-12', '石黒彩', 'Ishiguro Aya') BirthdayInsert('1996-05-14', '岡井明日菜', 'Okai Asuna') BirthdayInsert('1998-05-14', '堀江葵月', 'Horie Kizuki') BirthdayInsert('1995-05-15', '山賀香菜恵', 'Yamaga Kanae') BirthdayInsert('1972-05-18', '信田美帆', 'Shinoda Miho') BirthdayInsert('1992-05-22', '徳永千奈美', 'Tokunaga Chinami') BirthdayInsert('1991-05-24', '梅田えりか', 'Umeda Erika') BirthdayInsert('1984-05-28', 'ミカ・タレッサ・トッド', 'Mika Todd') BirthdayInsert('1998-05-28', '鞘師里保', 'Sayashi Riho') BirthdayInsert('2001-05-28', '佐々木莉佳子', 'Sasaki Rikako') BirthdayInsert('1994-05-29', '瀬崎あずさ', 'Sezaki Azusa') BirthdayInsert('1999-05-31', '島野萌々子', 'Shimano Momoko') BirthdayInsert('1997-06-04', '中西香菜', 'Nakanishi Kana') BirthdayInsert('1992-06-05', '古川小夏', 'Furukawa Konatsu') BirthdayInsert('1992-06-06', '村上愛', 'Murakami Megumi') BirthdayInsert('2003-06-07', '西田汐里', 'Nishida Shiori') BirthdayInsert('1995-06-08', '佐保明梨', 'Saho Akari') BirthdayInsert('1993-06-12', '後藤夕貴', 'Goto Yuki') BirthdayInsert('1998-06-12', '室田瑞希', 'Murota Mizuki') BirthdayInsert('1996-06-14', '関根梓', 'Sekine Azusa') BirthdayInsert('1993-06-15', '有原栞菜', 'Arihara Kanna') BirthdayInsert('1987-06-17', '辻希美', 'Tsuji Nozomi') BirthdayInsert('1973-06-19', '中澤裕子', 'Nakazawa Yuko') BirthdayInsert('1994-06-21', '岡井千聖', 'Okai Chisato') BirthdayInsert('1993-06-22', '西念未彩', 'Sainen Mia') BirthdayInsert('2002-06-23', '前田こころ', 'Maeda Kokoro') BirthdayInsert('1978-06-24', 'CHINO', 'CHINO') BirthdayInsert('2000-06-24', '島村嬉唄', 'Shimamura Uta') BirthdayInsert('1986-06-25', '松浦亜弥', 'Matsuura Aya') BirthdayInsert('1994-06-27', '古峰桃香', 'Komine Momoka') BirthdayInsert('2005-06-28', '山﨑愛生', 'Yamazaki Mei') BirthdayInsert('2004-06-29', '北川亮', 'Kitagawa Ryo') BirthdayInsert('1997-07-01', '金子りえ', 'Kaneko Rie') BirthdayInsert('1995-07-02', '金澤朋子', 'Kanazawa Tomoko') BirthdayInsert('1992-07-03', '須藤茉麻', 'Sudo Maasa') BirthdayInsert('1997-07-03', '橋本渚', 'Hashimoto Nagisa') BirthdayInsert('1990-07-04', '矢口めぐみ', 'Yaguchi Megumi') BirthdayInsert('1965-07-05', '小西貴雄', 'Konishi Takao') BirthdayInsert('1997-07-07', '生田衣梨奈', 'Ikuta Erina') BirthdayInsert('1999-07-07', '川村文乃', 'Kawamura Ayano') BirthdayInsert('1985-07-11', '藤咲裕美', 'Fujisaki Hiromi') BirthdayInsert('1989-07-13', '道重さゆみ', 'Michishige Sayumi') BirthdayInsert('1991-07-13', '小倉愛実', 'Ogura Manami') BirthdayInsert('1992-07-15', '久住小春', 'Kusumi Koharu') BirthdayInsert('1984-07-17', '木村麻美', 'Kimura Asami') BirthdayInsert('2001-07-17', '井上玲音', 'Inoue Rei') BirthdayInsert('2000-07-21', '田口夏実', 'Taguchi Natsumi') BirthdayInsert('1980-07-22', '北上アミ', 'Kitagami Ami') BirthdayInsert('1989-07-23', '鍾安琪', 'Zhong An Qi') BirthdayInsert('1998-07-28', '岡村里星', 'Okamura Rise') BirthdayInsert('2002-07-29', '秋山眞緒', 'Akiyama Mao') BirthdayInsert('1994-08-01', '和田彩花', 'Wada Ayaka') BirthdayInsert('1993-08-03', '熊井友理奈', 'Kumai Yurina') BirthdayInsert('1999-08-04', '広瀬彩海', 'Hirose Ayaka') BirthdayInsert('1998-08-05', '鈴木香音', 'Suzuki Kanon') BirthdayInsert('1967-08-06', '湯浅公一', 'Yuasa Koichi') BirthdayInsert('1981-08-08', '飯田圭織', 'Iida Kaori') BirthdayInsert('1981-08-10', '安倍なつみ', 'Abe Natsumi') BirthdayInsert('1979-08-14', '三佳千夏', 'Miyoshi Chinatsu') BirthdayInsert('1992-08-25', '夏焼雅', 'Natsuyaki Miyabi') BirthdayInsert('1986-08-26', '川島幸', 'Kawashima Miyuki') BirthdayInsert('2001-08-26', '斎藤夏奈', 'Saito Kana') BirthdayInsert('1979-08-28', '前田有紀', 'Maeda Yuki') BirthdayInsert('1992-08-28', '趙國蓉', 'Zhao Guo Rong') BirthdayInsert('1998-08-28', '三瓶海南', 'Mikame Kana') BirthdayInsert('1999-08-29', '真城佳奈', 'Mashiro Kana') BirthdayInsert('2001-08-29', '野口胡桃', 'Noguchi Kurumi') BirthdayInsert('2000-08-31', '井上ひかる', 'Inoue Hikaru') BirthdayInsert('2000-09-03', '浅倉樹々', 'Asakura Kiki') BirthdayInsert('1990-09-05', '阿部麻美', 'Abe Asami (SI☆NA)') BirthdayInsert('2001-09-05', '仲野りおん', 'Nakano Rion') BirthdayInsert('1983-09-06', 'ダニエル・デラウニー', 'Danielle Delaunay') BirthdayInsert('1996-09-06', '木沢留那', 'Kizawa Runa') BirthdayInsert('2000-09-10', '大浦央菜', 'Oura Hirona') BirthdayInsert('1986-09-14', '高橋愛', 'Takahashi Ai') BirthdayInsert('1995-09-19', '장다연', 'Jang Da Yeon') BirthdayInsert('1999-09-22', '吉橋くるみ', 'Yoshihashi Kurumi') BirthdayInsert('1985-09-23', '後藤真希', 'Goto Maki') BirthdayInsert('1982-09-26', 'チェルシー・チン', 'Chelsea Ching') BirthdayInsert('2004-09-28', '工藤由愛', 'Kudo Yume') BirthdayInsert('2000-09-29', '小野瑞歩', 'Ono Mizuho') BirthdayInsert('1992-10-03', '橋本愛奈', 'Hashimoto Aina') BirthdayInsert('2005-10-06', '橋迫鈴', 'Hashisako Rin') BirthdayInsert('1999-10-07', '野中美希', 'Nonaka Miki') BirthdayInsert('2002-10-07', '小野琴己', 'Ono Kotomi') BirthdayInsert('2002-10-09', '金津美月', 'Kanatsu Mizuki') BirthdayInsert('1963-10-12', 'ダンス☆マン', 'DANCE☆MAN') BirthdayInsert('1992-10-12', '大柳まほ', 'Ooyanagi Maho') BirthdayInsert('1993-10-12', '森咲樹', 'Mori Saki') BirthdayInsert('1997-10-14', '山木梨沙', 'Yamaki Risa') BirthdayInsert('1979-10-19', '柳原尋美', 'Yanagihara Hiromi') BirthdayInsert('1992-10-19', '秋山ゆりか', 'Akiyama Yurika') BirthdayInsert('1993-10-19', '湯徳歩美', 'Yutoku Ayumi') BirthdayInsert('1988-10-20', '新垣里沙', 'Niigaki Risa') BirthdayInsert('1999-10-20', '新沼希空', 'Niinuma Kisora') BirthdayInsert('2003-10-21', '太田遥香', 'Ota Haruka') BirthdayInsert('2003-10-22', '笠原桃奈', 'Kasahara Momona') BirthdayInsert('1980-10-23', '末永真己', 'Suenaga Mami') BirthdayInsert('1999-10-24', '上國料萌衣', 'Kamikokuryo Moe') BirthdayInsert('1999-10-27', '工藤遥', 'Kudo Haruka') BirthdayInsert('1968-10-29', 'つんく', 'Tsunku') BirthdayInsert('1987-10-29', '小川麻琴', 'Ogawa Makoto') BirthdayInsert('1981-10-30', '木村絢香', 'Kimura Ayaka') BirthdayInsert('1996-10-30', '譜久村聖', 'Fukumura Mizuki') BirthdayInsert('1998-10-30', '田村芽実', 'Tamura Meimi') BirthdayInsert('1981-10-31', '斉藤瞳', 'Saito Hitomi') BirthdayInsert('1989-11-01', '諸塚香奈実', 'Morozuka Kanami') BirthdayInsert('1985-11-04', '是永美記', 'Korenaga Miki') BirthdayInsert('1998-11-05', '小片リサ', 'Ogata Risa') BirthdayInsert('2002-11-05', '山﨑夢羽', 'Yamazaki Yuhane') BirthdayInsert('1994-11-07', '飯窪春菜', 'Iikubo Haruna') BirthdayInsert('1984-11-08', '三好絵梨香', 'Miyoshi Erika') BirthdayInsert('1996-11-08', '長澤和奏', 'Nagasawa Wakana') BirthdayInsert('1999-11-10', '田辺奈菜美', 'Tanabe Nanami') BirthdayInsert('1989-11-11', '田中れいな', 'Tanaka Reina') BirthdayInsert('1978-11-14', '宅見将典', 'Takumi Masanori') BirthdayInsert('1996-11-18', '小川紗季', 'Ogawa Saki') BirthdayInsert('1997-11-19', '新井愛瞳', 'Arai Manami') BirthdayInsert('1997-11-19', '小数賀芙由香', 'Kosuga Fuyuka') BirthdayInsert('1992-11-20', '石村舞波', 'Ishimura Maiha') BirthdayInsert('1991-11-22', '清水佐紀', 'Shimizu Saki') BirthdayInsert('1997-11-23', '竹内朱莉', 'Takeuchi Akari') BirthdayInsert('1998-11-24', '山岸理子', 'Yamagishi Riko') BirthdayInsert('1991-11-25', '澤田由梨', 'Sawada Yuri') BirthdayInsert('1993-11-29', '北原沙弥香', 'Kitahara Sayaka') BirthdayInsert('1999-11-30', '加賀楓', 'Kaga Kaede') BirthdayInsert('1998-12-01', '宮本佳林', 'Miyamoto Karin') BirthdayInsert('1980-12-06', '保田圭', 'Yasuda Kei') BirthdayInsert('1996-12-14', '古筠', 'Gu Yun') BirthdayInsert('1984-12-17', '福田明日香', 'Fukuda Asuka') BirthdayInsert('1989-12-17', '岩嶋雅奈未', 'Iwashima Manami') BirthdayInsert('2001-12-17', '小野田紗栞', 'Onoda Saori') BirthdayInsert('2002-12-21', '藍愛子', 'Lan Ai Zi') BirthdayInsert('2004-12-22', '清野桃々姫', 'Kiyono Momohime') BirthdayInsert('1988-12-23', '亀井絵里', 'Kamei Eri') BirthdayInsert('1997-12-24', '田中可恋', 'Tanaka Karen') BirthdayInsert('1988-12-26', '能登有沙', 'Noto Arisa') BirthdayInsert('1997-12-27', '稲場愛香', 'Inaba Manaka') BirthdayInsert('2000-12-27', '吳兆絃', 'Wu Zhao Xian') BirthdayInsert('1987-12-28', '岡田唯', 'Okada Yui') BirthdayInsert('1994-12-28', '前田憂佳', 'Maeda Yuuka') BirthdayInsert('1998-12-30', '植村あかり', 'Uemura Akari') BirthdayInsert('1983-12-31', '市井紗耶香', 'Ichii Sayaka') function Ordinal(anumber) if anumber % 10 == 1 then return anumber .. "st" elseif anumber % 10 == 2 then if anumber%100==12 then return anumber .. "th" else return anumber .. "nd" end elseif anumber % 10 == 3 then if anumber%100==13 then return anumber .. "th" else return anumber .. "rd" end else return anumber .. "th" end end function WhichBirthday(yyyymmdd) --Just rounds to which age is nearest. For standard uses of looking forward a week, it does the trick. _, _, y, m, d = string.find(yyyymmdd, "(%d%d%d%d)-(%d%d)-(%d%d)") difference = os.time - os.time{year=y, month=m, day=d} difference = difference / 31555008 difference = math.floor(difference+0.5) --Rounding return Ordinal(difference) end function WhereDayXStarts(mmdd) i = 0 repeat i=i+1 until string.sub( D[i], 6, 10 ) >= mmdd or i == table.getn(D) if string.sub(D[i], 6, 10) < mmdd then i = 1 end --If we've gone all the way and found squat, stick to the beginning. return i --.. " " .. string.sub( D[i], 6, 10 ) .. " >= " .. mmdd .. " or i == " .. table.getn(D) end function WhereDayXEnds(mmdd) _, _, m, d = string.find(mmdd, "(%d%d)-(%d%d)") if d+1 < 10 then nextday = m .. "-0" .. d+1 --Needs zero padded else nextday = m .. "-" .. d+1 --Even if this date isnt' real, it should work as a point of comparison end if nextday=="12-32" then return table.getn(D) -- As long as things are properly ordered, the table ends with the end of the year. else thisdaybegins = WhereDayXStarts(mmdd) itbegins = WhereDayXStarts(nextday) if(thisdaybegins==itbegins) then --Next day starts no later than today, so no need to subtract 1. ThenWhereDayXEnds = itbegins else ThenWhereDayXEnds = itbegins - 1 --Just before where the next day starts, see. if ThenWhereDayXEnds == 0 then ThenWhereDayXEnds = table.getn(D) end --Again if the very beginning is "after", the end is... the end. end return ThenWhereDayXEnds end end function p.upcoming(frame) num_days = tonumber(frame.args.days or 7) num_min = tonumber(frame.args.min or 2) starting = frame.args.starting or os.date("%m-%d",os.time+32400) ending = os.date("%m-%d", os.time{year=2001, month=string.sub(starting,1,2), day=string.sub(starting,4,5)}+86400*(num_days-1)) STARTBEGINS = WhereDayXStarts(starting) ENDENDS = WhereDayXEnds(ending) LISTEND = table.getn(D) --output = "starting: " .. starting .. " ending: " .. ending .. " STARTBEGINS: " .. STARTBEGINS .. " ENDENDS: " .. ENDENDS .. " LISTEND: " .. LISTEND startread2 = 0 endread2 = -1 if ENDENDS>=STARTBEGINS then if (ENDENDS-STARTBEGINS+1) >= num_min then --Is Y greater than X and Y-X>=Min? Fantastic! Read from spots X through Y.           --output = output .. " CASE 1 " startread1 = STARTBEGINS endread1 = ENDENDS startread2 = 0 elseif (LISTEND-STARTBEGINS+1) >= num_min then --Is Y greater than X, Y-X=Min? OK, find what date X+Min is, find where that date ends, call it Y. Read from spots X through Y.           --output = output .. " CASE 2 " ending = string.sub(D[STARTBEGINS+num_min-1], 6, 10 ) --mm-dd for minimum spot ENDENDS = WhereDayXEnds(ending) startread1 = STARTBEGINS endread1 = ENDENDS else --Need more to hit minimum, rest of list isn't enough. Need to check beginning of list for end of minimum and read those too. --output = output .. " CASE 3 " ending = string.sub(D[num_min-(LISTEND-STARTBEGINS+1)], 6, 10 ) --mm-dd for minimum spot ENDENDS = WhereDayXEnds(ending) startread1 = STARTBEGINS endread1 = LISTEND startread2 = 1 endread2 = ENDENDS end else if (LISTEND-STARTBEGINS+ENDENDS) >= num_min then --Is Y less than X and (End-X+Y)>=Min? Read from spots X through End, then 1 through Y.           --output = output .. " CASE 4 " startread1 = STARTBEGINS endread1 = LISTEND startread2 = 1 endread2 = ENDENDS else --Is Y less than X, (End-X+Y)<Min? OK, find what date (Min-End-X) is, find where that date ends, call it Y. Read from spots X through End, then 1 through Y.           --Very similar to an earlier case, except this time Y has already looped. Calculations should remain the same, though. --output = output .. " CASE 5 " ending = string.sub(D[num_min-(LISTEND-STARTBEGINS+1)], 6, 10 ) --mm-dd for minimum spot ENDENDS = WhereDayXEnds(ending) startread1 = STARTBEGINS endread1 = LISTEND startread2 = 1 endread2 = ENDENDS end end --output = output .. " ending: " .. ending .. " ENDENDS: " .. ENDENDS --output = output.. " startread1: " .. startread1 .. " " .. T[startread1] .. " endread1: " .. endread1 .. " " .. T[endread1] .. " startread2: " .. startread2 .. " endread2: " .. endread2 .. "\n" lastday = 0 output = "" --First read group i = startread1 while i<= endread1 do       thisday = string.sub( D[i], 6, 10 ) if thisday ~= lastday then --It's a new day, something should be written. output = output .. ";" .. os.date("%B %e", os.time{year=2001, month=string.sub(D[i],6,7), day=string.sub(D[i],9,10)}) .. ", "           if thisday==starting then output = output .. "Happy Birthday!" else output = output .. "Coming Soon" end output = output .. "\n" end output = output .. ":" .. T[i] .. " (" .. WhichBirthday(D[i]) .. ")\n" lastday = thisday i=i+1 end --Second read group i = startread2 while i<= endread2 do       thisday = string.sub( D[i], 6, 10 ) if thisday ~= lastday then --It's a new day, something should be written. output = output .. ";" .. os.date("%B %e", os.time{year=2001, month=string.sub(D[i],6,7), day=string.sub(D[i],9,10)}) .. ", "           if thisday==starting then output = output .. "Happy Birthday!" else output = output .. "Coming Soon" end output = output .. "\n" end output = output .. ":" .. T[i] .. " (" .. WhichBirthday(D[i]) .. ")\n" lastday = thisday i=i+1 end return output -- .. " " .. os.clock end function p.year(frame) year = frame.args[1] or 1982 lastday = 0 output = "" for i=1, table.getn(D), 1 do       if string.sub(D[i],1,4) == year then thisday = string.sub( D[i], 6, 10 ) if thisday ~= lastday then output = output .. ";" .. os.date("%B %e", os.time{year=2001, month=string.sub(D[i],6,7), day=string.sub(D[i],9,10)}) .. "\n" end output = output .. ":" .. T[i] .. "\n" lastday = thisday end end return output end function p.month(frame) month = frame.args[1] or 1 if month == '1' or month == '01' then starting='01-01' ending='02-01' elseif month == '2' or month == '02' then starting='02-01' ending='03-01' elseif month == '3' or month == '03' then starting='03-01' ending='04-01' elseif month == '4' or month == '04' then starting='04-01' ending='05-01' elseif month == '5' or month == '05' then starting='05-01' ending='06-01' elseif month == '6' or month == '06' then starting='06-01' ending='07-01' elseif month == '7' or month == '07' then starting='07-01' ending='08-01' elseif month == '8' or month == '08' then starting='08-01' ending='09-01' elseif month == '9' or month == '09' then starting='09-01' ending='10-01' elseif month == '10' then starting='10-01' ending='11-01' elseif month == '11' then starting='11-01' ending='12-01' elseif month == '12' then starting='12-01' ending='12-31' end STARTBEGINS = WhereDayXStarts(starting) --ENDENDS = WhereDayXEnds(ending) if month=='12' then NEXTBEGINS = table.getn(D) + 1 -- Past the end else NEXTBEGINS = WhereDayXStarts(ending) end lastday = 0 output = "" i = STARTBEGINS while i < NEXTBEGINS do       thisday = string.sub( D[i], 6, 10 ) if thisday ~= lastday then --It's a new day, something should be written. output = output .. ";" .. os.date("%B %e", os.time{year=2001, month=string.sub(D[i],6,7), day=string.sub(D[i],9,10)}) .. "\n" end output = output .. ":" .. T[i] .. " (" .. string.sub(D[i], 1, 4) .. ")\n" lastday = thisday i=i+1 end return output end function p.age(frame) age = frame.args[1] or 20 output = "" starting = os.date("%Y-%m-%d",os.time+32400) --Y-m-d for today in Japan _, _, y, m, d = string.find(starting, "(%d%d%d%d)-(%d%d)-(%d%d)") LOWBORDER = y-age .. "-" .. m .. "-" .. d   if d+1<10 then --needs a leading 0 HIGHBORDER = y-age-1 .. "-" .. m .. "-0" .. d+1 else HIGHBORDER = y-age-1 .. "-" .. m .. "-" .. d+1 --Might be an improper date, but for comparison purposes should work end --output = "LOWBORDER: " .. LOWBORDER .. " HIGHBORDER: " .. HIGHBORDER --return output STARTBEGINS = WhereDayXStarts(string.sub(HIGHBORDER,6,10)) --First half i = STARTBEGINS while i<= table.getn(D) do       if D[i] >= HIGHBORDER and D[i] <= LOWBORDER then output = output .. ":" .. T[i] .. " (" .. D[i] .. ")\n" end i=i+1 end --Second half i = 1 while i<= STARTBEGINS-1 do       if D[i] >= HIGHBORDER and D[i] <= LOWBORDER then output = output .. ":" .. T[i] .. " (" .. D[i] .. ")\n" end i=i+1 end return output end function p.between(frame) startdate=frame.args[1] enddate=frame.args[2] if startdate > enddate then --You trying to screw things up? Well, we'll just flip 'em. temp = startdate startdate = enddate enddate = temp end output = "" year = string.sub(startdate,1,4) while year<=string.sub(enddate,1,4) do       if year==string.sub(startdate,1,4) then lowcomparison = string.sub(startdate,6,10) --If it's the first year, only start at the given date else lowcomparison = '01-01' end if year==string.sub(enddate,1,4) then highcomparison = string.sub(enddate,6,10) --If it's the last year, stop by the given date else highcomparison = '12-31' end i = 1 while i<= table.getn(D) do           if string.sub(D[i],1,4) == year and string.sub(D[i],6,10) >= lowcomparison and string.sub(D[i],6,10) <= highcomparison then output = output .. ":" .. T[i] .. " (" .. D[i] .. ")\n" end i=i+1 end year=tostring(year+1) end return output end function p.random math.randomseed( os.time ) return "" .. T[math.random(" end return p -- --ja:モジュール:誕生日 --cs:Modul:Narozeniny