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:
Achintha Isuru
2026-03-19 13:00:17 -04:00
parent eacf34999b
commit 5792aa6e98
37 changed files with 136 additions and 109 deletions

View File

@@ -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';
}

View File

@@ -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();
}
}