Skip to content

Commit

Permalink
fix: Fixed a bug that Timestamp was not converted.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Jan 20, 2024
1 parent 30c3db3 commit abe0ff8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,9 @@ class FirestoreModelTimestampConverter
};
}
} else if (value is Timestamp) {
final targetKey = "#$key";
final targetMap = original.getAsMap(targetKey);
final type = targetMap.get(_kTypeKey, "");
if (type == this.type) {
return {
key: ModelTimestamp(value.toDate()).toJson(),
};
}
return {
key: ModelTimestamp(value.toDate()).toJson(),
};
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ abstract class FirestoreModelFieldValueConverter {
static const Set<FirestoreModelFieldValueConverter> defaultConverters = {
FirestoreModelCommandBaseConverter(),
FirestoreModelCounterConverter(),
FirestoreModelTimestampConverter(),
FirestoreModelDateConverter(),
// Timestampを必ず変換するためTimestamp変換系はこれを一番最後にすること
FirestoreModelTimestampConverter(),
FirestoreModelLocaleConverter(),
FirestoreModelLocalizedValueConverter(),
FirestoreModelUriConverter(),
Expand Down
2 changes: 1 addition & 1 deletion packages/katana_model_firestore/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ packages:
path: "../katana_model"
relative: true
source: path
version: "2.18.2"
version: "2.18.5"
lints:
dependency: transitive
description:
Expand Down

0 comments on commit abe0ff8

Please sign in to comment.