Parrots Feeding Schedule Reminder

⏰ Feeding Schedule Builder

Create feeding times, print the schedule or download calendar reminders.

Note: The .ics will create a daily repeating event at the first time you added; you can manually edit in calendar apps as needed.
`; const w = window.open(''); w.document.write(html); w.document.close(); w.print(); });// Simple ICS generator - creates daily repeating event at first time icsBtn.addEventListener('click', ()=>{ const a = getSched().sort((x,y)=>x.time.localeCompare(y.time)); if(!a.length){ alert('Add items first.'); return; } const first = a[0]; const now = new Date(); const [hh,mm] = first.time.split(':').map(Number); // next occurrence (today or tomorrow) const evStart = new Date(now.getFullYear(), now.getMonth(), now.getDate(), hh, mm, 0); if(evStart < now) evStart.setDate(evStart.getDate()+1); function toICSDate(d){ return d.toISOString().replace(/[-:]/g,'').split('.')[0]+'Z'; } const dtstart = toICSDate(evStart); const dtend = toICSDate(new Date(evStart.getTime()+20*60000)); // 20 minute event const ics = [ 'BEGIN:VCALENDAR', 'VERSION:2.0', 'PRODID:-//TinyParrots//FeedingSchedule//EN', 'BEGIN:VEVENT', `UID:${Date.now()}@tinyparrots`, `DTSTAMP:${toICSDate(new Date())}`, `DTSTART:${dtstart}`, `DTEND:${dtend}`, `RRULE:FREQ=DAILY`, `SUMMARY:Feeding - ${first.note || 'Parrot feeding'}`, `DESCRIPTION:Feeding schedule generated by TinyParrots.com`, 'END:VEVENT', 'END:VCALENDAR' ].join('\r\n'); const blob = new Blob([ics], {type:'text/calendar'}); const url = URL.createObjectURL(blob); const aEl = document.createElement('a'); aEl.href = url; aEl.download = 'parrot-feeding.ics'; document.body.appendChild(aEl); aEl.click(); aEl.remove(); URL.revokeObjectURL(url); });render(); })();

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.