Correct calendar deadline export and isolate notification storage

This commit is contained in:
2026-09-06 12:50:06 +03:00
parent f2b33749a7
commit c7bb67b101
7 changed files with 54 additions and 6 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ export function tenderDeadline(t) {
throw new Error('Geçersiz ihale tarihi veya saati.');
return new Date(Date.UTC(Number(year),Number(month)-1,Number(day),hour-3,minute));
}
const escapeICS = v => String(v || '').replace(/\\/g,'\\\\').replace(/\r?\n/g,'\\n').replace(/;/g,'\\;').replace(/,/g,'\\,');
const escapeICS = v => String(v || '').replace(/\\/g,'\\\\').replace(/\r\n|\r|\n/g,'\\n').replace(/;/g,'\\;').replace(/,/g,'\\,');
const stamp = date => date.toISOString().replace(/[-:]/g,'').replace(/\.\d{3}Z$/,'Z');
function fold(line) {
const result = []; let current = '';
@@ -31,9 +31,9 @@ export function createTenderICS(t, now = new Date()) {
if (!uid) throw new Error('İhale kimliği gerekli.');
return ['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Ihaleist//Tender Calendar//TR','CALSCALE:GREGORIAN',
'BEGIN:VEVENT',`UID:${uid}@ihaleist.com`,`DTSTAMP:${stamp(now)}`,
`DTSTART:${stamp(start)}`,`DTEND:${stamp(start)}`,
`DTSTART:${stamp(start)}`,'TRANSP:TRANSPARENT',
`SUMMARY:${escapeICS('İhale son teklif: '+t.baslik)}`,
`DESCRIPTION:${escapeICS('İKN: '+t.ikn+' — '+t.kurum)}`,
`DESCRIPTION:${escapeICS('İKN: '+t.ikn+' — '+t.kurum+'\nBu tek seferlik takvim kaydı otomatik güncellenmez. İhale tarihini resmi kaynaktan doğrulayın; değişiklikte takviminizdeki eski kaydı güncelleyin.')}`,
'END:VEVENT','END:VCALENDAR',''].map(fold).join('\r\n');
}