TimeZoneHelper class

Helper class for handling timezone differences between client and server

Constructors

TimeZoneHelper()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

dateStringToUtc(String? dateString) DateTime?
Convert a date-only string (YYYY-MM-DD) to DateTime at midnight UTC
dateTimeToDateString(DateTime? dateTime) String?
Convert a DateTime to date-only string in local timezone
formatLocalDate(DateTime? dateTime, {String format = 'yyyy/M/d'}) String
Format a DateTime for display in local timezone
formatLocalDateTime(DateTime? dateTime, {String format = 'yyyy/M/d HH:mm'}) String
Format a DateTime for display with time in local timezone
fromServerTime(String serverTimeString) DateTime
Convert a server timestamp (assumed UTC) to local time for display
isSameLocalDate(DateTime? date1, DateTime? date2) bool
Check if two dates are the same day in local time
nowUtc() DateTime
Get current time in UTC for server communication
toServerTime(DateTime localTime) DateTime
Convert a local DateTime to UTC for server communication