@@ -37,7 +37,7 @@ public final class FirebaseFirestoreSettings {
37
37
// we will switch the default to the above value, 100 MB.
38
38
private static final long DEFAULT_CACHE_SIZE_BYTES = CACHE_SIZE_UNLIMITED ;
39
39
private static final String DEFAULT_HOST = "firestore.googleapis.com" ;
40
- private static final boolean DEFAULT_TIMESTAMPS_IN_SNAPSHOTS_ENABLED = false ;
40
+ private static final boolean DEFAULT_TIMESTAMPS_IN_SNAPSHOTS_ENABLED = true ;
41
41
42
42
/** A Builder for creating {@link FirebaseFirestoreSettings}. */
43
43
@ PublicApi
@@ -110,28 +110,27 @@ public Builder setPersistenceEnabled(boolean value) {
110
110
}
111
111
112
112
/**
113
- * Enables the use of {@link com.google.firebase.Timestamp Timestamps} for timestamp fields in
114
- * {@link DocumentSnapshot DocumentSnapshots}.
113
+ * Specifies whether to use {@link com.google.firebase.Timestamp Timestamps} for timestamp
114
+ * fields in {@link DocumentSnapshot DocumentSnapshots}. This is now enabled by default and
115
+ * should not be disabled.
115
116
*
116
- * <p>Currently, Firestore returns timestamp fields as {@link java.util.Date} but {@link
117
- * java.util.Date Date} only supports millisecond precision, which leads to truncation and
118
- * causes unexpected behavior when using a timestamp from a snapshot as a part of a subsequent
119
- * query.
117
+ * <p>Previously, Firestore returned timestamp fields as {@link java.util.Date} but {@link
118
+ * java.util.Date} only supports millisecond precision, which leads to truncation and causes
119
+ * unexpected behavior when using a timestamp from a snapshot as a part of a subsequent query.
120
120
*
121
- * <p>Setting {@code setTimestampsInSnapshotsEnabled(true)} will cause Firestore to return
122
- * {@link com.google.firebase.Timestamp Timestamp} values instead of {@link java.util.Date
123
- * Date}, avoiding this kind of problem. To make this work you must also change any code that
124
- * uses {@link java.util.Date Date} to use {@link com.google.firebase.Timestamp Timestamp}
125
- * instead.
121
+ * <p>So now Firestore returns {@link com.google.firebase.Timestamp Timestamp} values instead of
122
+ * {@link java.util.Date}, avoiding this kind of problem.
126
123
*
127
- * <p>NOTE: in the future {@link FirebaseFirestoreSettings#areTimestampsInSnapshotsEnabled} will
128
- * default to true and this option will be removed so you should change your code to use
129
- * Timestamp now and opt-in to this new behavior as soon as you can.
124
+ * <p>To opt into the old behavior of returning {@link java.util.Date Dates}, you can
125
+ * temporarily set {@link FirebaseFirestoreSettings#areTimestampsInSnapshotsEnabled} to false.
130
126
*
131
- * @return A settings object on which the return type for timestamp fields is configured as
132
- * specified by the given {@code value}.
127
+ * @deprecated This setting now defaults to true and will be removed in a future release. If you
128
+ * are already setting it to true, just remove the setting. If you are setting it to false,
129
+ * you should update your code to expect {@link com.google.firebase.Timestamp Timestamps}
130
+ * instead of {@link java.util.Date Dates} and then remove the setting.
133
131
*/
134
132
@ NonNull
133
+ @ Deprecated
135
134
@ PublicApi
136
135
public Builder setTimestampsInSnapshotsEnabled (boolean value ) {
137
136
this .timestampsInSnapshotsEnabled = value ;
0 commit comments