feat: add UTC parsing utilities and update date handling across entities
- Introduced `utc_parser.dart` with functions to convert UTC timestamps to local time. - Updated date parsing in various entities to use the new utility functions for consistency. - Refactored date handling in `BenefitHistory`, `Business`, `AttendanceStatus`, `AssignedWorker`, `TimeRange`, `Invoice`, `PaymentChartPoint`, `StaffPayment`, `TimeCardEntry`, `OrderItem`, `OrderPreview`, `RecentOrder`, `StaffRating`, `CoverageDayPoint`, `ForecastWeek`, `NoShowIncident`, `SpendDataPoint`, `AssignedShift`, `CancelledShift`, `CompletedShift`, `OpenShift`, `PendingAssignment`, `Shift`, `ShiftDetail`, `TodayShift`, `BusinessMembership`, and `Staff`. - Updated `ReorderWidget` and `OrderEditSheet` to handle date formatting correctly.
This commit is contained in:
@@ -32,7 +32,7 @@ class AuthInterceptor extends Interceptor {
|
||||
if (!skipAuth) {
|
||||
final User? user = FirebaseAuth.instance.currentUser;
|
||||
if (user != null) {
|
||||
final String? token = await user.getIdToken();
|
||||
final String? token = await user.getIdToken();
|
||||
if (token != null) {
|
||||
options.headers['Authorization'] = 'Bearer $token';
|
||||
}
|
||||
|
||||
@@ -4,4 +4,9 @@ class DateTimeUtils {
|
||||
static DateTime toDeviceTime(DateTime date) {
|
||||
return date.toLocal();
|
||||
}
|
||||
|
||||
/// Converts a local [DateTime] back to UTC for API payloads.
|
||||
static String toUtcIso(DateTime local) {
|
||||
return local.toUtc().toIso8601String();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user