fix
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../../domain/entities/client_notification.dart';
|
||||
|
||||
class ClientNotificationDto {
|
||||
@@ -43,12 +42,19 @@ class ClientNotificationDto {
|
||||
clientId: clientId,
|
||||
type: _parseType(type),
|
||||
category: _parseCategory(category),
|
||||
createdAt: DateTime.parse(createdAt),
|
||||
canceledAt: canceledAt != null ? DateTime.parse(canceledAt!) : null,
|
||||
readAt: readAt != null ? DateTime.parse(readAt!) : null,
|
||||
createdAt: _parseUtcDate(createdAt),
|
||||
canceledAt: canceledAt != null ? _parseUtcDate(canceledAt!) : null,
|
||||
readAt: readAt != null ? _parseUtcDate(readAt!) : null,
|
||||
);
|
||||
}
|
||||
|
||||
DateTime _parseUtcDate(String dateString) {
|
||||
if (dateString.endsWith('Z') || dateString.contains('+') || dateString.contains('-')) {
|
||||
return DateTime.parse(dateString).toLocal();
|
||||
}
|
||||
return DateTime.parse('${dateString}Z').toLocal();
|
||||
}
|
||||
|
||||
NotificationType _parseType(String type) {
|
||||
switch (type.toLowerCase()) {
|
||||
case 'info':
|
||||
@@ -80,4 +86,4 @@ class ClientNotificationDto {
|
||||
return NotificationCategory.companyInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user