@bobfrankston/rmfmail 1.1.30 → 1.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -239,10 +239,19 @@ export class SyncManager implements WebSyncManager {
239
239
  if (msg.answered) flags.push("\\Answered");
240
240
  if (msg.draft) flags.push("\\Draft");
241
241
  const bodyPath = msg.providerId ? `gmail:${msg.providerId}` : "";
242
+ // `messages.date` is NOT NULL. An unparseable envelope date
243
+ // yields an *Invalid Date* — truthy, `instanceof Date`, but
244
+ // `.getTime()` is NaN, which binds as NULL and fails the
245
+ // constraint, aborting the whole batch. Default any non-finite
246
+ // value to now.
247
+ const dateRaw = msg.date instanceof Date ? msg.date.getTime()
248
+ : typeof msg.date === "number" ? msg.date
249
+ : NaN;
250
+ const dateMs = Number.isFinite(dateRaw) ? dateRaw : Date.now();
242
251
  this.db.upsertMessage({
243
252
  accountId, folderId, uid: msg.uid,
244
253
  messageId: msg.messageId || "", inReplyTo: "", references: [],
245
- date: msg.date ? msg.date.getTime() : Date.now(),
254
+ date: dateMs,
246
255
  subject: msg.subject || "",
247
256
  from: toEmailAddress(msg.from?.[0]),
248
257
  to: msg.to.map((a: any) => toEmailAddress(a)),