3 Commits

Author SHA1 Message Date
d5d2fa5836 Bugfix "Not sending 'Todays Events'"
Format Month and Day with a Leading 0 for values between 1 to 9 when querying the DB for Todays Events only.
2025-11-07 00:27:45 +00:00
ca102190ea Changed: only get Events from the Db which are not marked as deleted, indicated by having a value for "deleteDate" 2025-11-07 00:25:15 +00:00
8fee748837 Added "hour" to getTsNow() 2025-11-07 00:24:03 +00:00
3 changed files with 5 additions and 4 deletions

View File

@@ -21,8 +21,8 @@ async function events_update_db() {
const events_fetched_list_of_uids = events_fetched.map( event => { return event.uid; });
console.dir( {events_fetched_list_of_uids} );
const events_db_currentMonth = Event.get_events({month: {year: TODAY.year, month: TODAY.month}}, db);
const events_db_nextMonth = Event.get_events({month: {year: TODAY.year, month: (TODAY.month + 1)}}, db);
const events_db_currentMonth = Event.get_events({month: {year: TODAY.year, month: TODAY.month}, deleted: false}, db);
const events_db_nextMonth = Event.get_events({month: {year: TODAY.year, month: (TODAY.month + 1)}, deleted: false}, db);
const events_db = [... events_db_currentMonth, ... events_db_nextMonth];
const events_removed: Event[] = events_db.filter( (ev) => {
return ! events_fetched_list_of_uids.includes(ev.uid);

View File

@@ -95,10 +95,10 @@ export class Event implements TEventEntity {
whereConditions.push( `notification IN ('${ options.notification.join("', '") }')` )
}
if ( options.date ) {
whereConditions.push(`date_at = "${options.date.year}-${options.date.month}-${options.date.day}"`);
whereConditions.push(`date_at = "${options.date.year}-${pad_l2(options.date.month)}-${pad_l2(options.date.day)}"`);
}
if ( options.month ) {
whereConditions.push( `strftime('%Y-%m', date_at) = '${options.month.year}-${options.month.month}'`)
whereConditions.push( `strftime('%Y-%m', date_at) = '${options.month.year}-${pad_l2(options.month.month)}'`)
}
const where = ( () => {

View File

@@ -34,6 +34,7 @@ export function getTsNow() {
year: now.getFullYear(),
month: now.getMonth() + 1,
day: now.getDate(),
hour: now.getHours(),
minute: now.getMinutes(),
seconds: now.getSeconds()
}