update: fix invoice proccessor

This commit is contained in:
Mahyargdz
2025-05-10 12:30:39 +03:30
parent 24bc359c3f
commit ad4bf79afb
3 changed files with 18 additions and 6 deletions
@@ -14,8 +14,6 @@ import { NotificationProcessor } from "./queue/notification.processor";
import { NotificationQueue } from "./queue/notification.queue";
import { NotificationRepository } from "./repositories/notifications.repository";
import { NotificationSetting } from "../settings/entities/notification-setting.entity";
import { EmailService } from "../utils/providers/email.service";
import { SmsService } from "../utils/providers/sms.service";
@Module({
imports: [
@@ -38,7 +36,7 @@ import { SmsService } from "../utils/providers/sms.service";
UtilsModule,
SettingModule,
],
providers: [NotificationRepository, NotificationsService, NotificationQueue, NotificationProcessor, SmsService, EmailService],
providers: [NotificationRepository, NotificationsService, NotificationQueue, NotificationProcessor],
controllers: [NotificationController],
exports: [NotificationRepository, NotificationsService, NotificationQueue],
})
@@ -2,6 +2,20 @@ export function numberFormat(number: number, locale: string = "fa-IR") {
return Intl.NumberFormat(locale).format(number);
}
export function dateFormat(date: Date, locale: string = "fa-IR") {
return new Intl.DateTimeFormat(locale).format(date);
export function dateFormat(date: Date | string | number, locale: string = "fa-IR") {
try {
// Convert to Date object if it's a string or number
const dateObj = date instanceof Date ? date : new Date(date);
// Check if the date is valid
if (isNaN(dateObj.getTime())) {
console.warn("Invalid date provided to dateFormat:", date);
return "Invalid Date";
}
return new Intl.DateTimeFormat(locale).format(dateObj);
} catch (error) {
console.error("Error formatting date:", error);
return "Invalid Date";
}
}