done
This commit is contained in:
@@ -79,6 +79,7 @@ class AttendanceRemoteDataSourceImpl implements AttendanceRemoteDataSource {
|
||||
if (e is ServerException || e is NetworkException) {
|
||||
rethrow;
|
||||
}
|
||||
print('خطأ غير متوقع: $e');
|
||||
throw ServerException(message: 'خطأ غير متوقع');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,24 @@ class AttendanceResponseDto {
|
||||
final data = json['data'];
|
||||
|
||||
return AttendanceResponseDto(
|
||||
id: data['id'],
|
||||
employeeId: data['employeeId'],
|
||||
login: data['login'],
|
||||
logout: data['logout'],
|
||||
id: data['id']?.toString() ?? '',
|
||||
employeeId: data['employeeId']?.toString() ?? '',
|
||||
login: _parseDateTime(data['login']),
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user