This commit is contained in:
Mohammed Al-Samarraie
2026-01-16 14:58:12 +03:00
parent 2fd5aff0c2
commit 8adab4c4af
2 changed files with 19 additions and 4 deletions

View File

@@ -79,6 +79,7 @@ class AttendanceRemoteDataSourceImpl implements AttendanceRemoteDataSource {
if (e is ServerException || e is NetworkException) { if (e is ServerException || e is NetworkException) {
rethrow; rethrow;
} }
print('خطأ غير متوقع: $e');
throw ServerException(message: 'خطأ غير متوقع'); throw ServerException(message: 'خطأ غير متوقع');
} }
} }

View File

@@ -15,10 +15,24 @@ class AttendanceResponseDto {
final data = json['data']; final data = json['data'];
return AttendanceResponseDto( return AttendanceResponseDto(
id: data['id'], id: data['id']?.toString() ?? '',
employeeId: data['employeeId'], employeeId: data['employeeId']?.toString() ?? '',
login: data['login'], login: _parseDateTime(data['login']),
logout: data['logout'], logout: _parseDateTime(data['logout']),
); );
} }
static DateTime? _parseDateTime(dynamic value) {
if (value == null) return null;
if (value is DateTime) return value;
if (value is String) {
try {
return DateTime.parse(value);
} catch (e) {
print('Error parsing date: $value - $e');
return null;
}
}
return null;
}
} }