Skip to content

Commit

Permalink
updated parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ygit committed Nov 6, 2023
1 parent 83d89ed commit a277237
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class HMSPeerExtension {
args["audio_track"] = HMSTrackExtension.toDictionary(peer.audioTrack)
args["video_track"] = HMSTrackExtension.toDictionary(peer.videoTrack)
args["network_quality"] = HMSNetworkQualityExtension.toDictionary(peer.networkQuality)
args["joined_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(peer.joinedAt).toString()
args["joined_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(peer.joinedAt).toString() // should be seconds since epoch time

val auxTrackList = ArrayList<Any>()
peer.auxiliaryTracks.forEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class HMSPeerExtension {
"is_hand_raised": peer.isHandRaised,
"customer_description": peer.metadata ?? "",
"customer_user_id": peer.customerUserID ?? "",
"joined_at": "\(peer.joinedAt)",
"joined_at": "\(peer.joinedAt.timeIntervalSince1970)",
"updated_at": "\(peer.updatedAt)"
] as [String: Any]

Expand Down
11 changes: 8 additions & 3 deletions packages/hmssdk_flutter/lib/src/model/hms_date_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
///[HMSDateExtension] is used to convert android and ios native time format to DateTime type
///in local time zone format.
class HMSDateExtension {
static DateTime convertDate(String date) {
DateTime _dateTime = DateTime.parse(date).toLocal();
return _dateTime;
static DateTime? convertDate(String date) {
try {
DateTime _dateTime = DateTime.parse(date).toLocal();
return _dateTime;
} catch (e) {
print(e);
}
return null;
}
}

0 comments on commit a277237

Please sign in to comment.