toJson method

  1. @override
dynamic toJson(
  1. DateTime? dateTime
)

Implementation

@override
dynamic toJson(DateTime? dateTime) {
  if (dateTime == null) return null;

  // Always return as milliseconds for JSON compatibility
  // The BaseFirestoreModel will handle conversion to FieldValue.serverTimestamp
  // or Timestamp based on the context and field configuration
  return dateTime.millisecondsSinceEpoch;
}