import 'dart:convert';
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:timeago/timeago.dart' as timeago;
import '/flutter_flow/lat_lng.dart';
import '/flutter_flow/place.dart';
import '/flutter_flow/uploaded_file.dart';
import '/flutter_flow/custom_functions.dart';
import '/backend/supabase/supabase.dart';
import '/auth/supabase_auth/auth_util.dart';
List<DateTime>? months(DateTime? current) {
if (current == null) {
return null;
}
List<DateTime> monthDays = [];
DateTime firstDay = DateTime(current.year, current.month, 1);
DateTime lastDay = DateTime(current.year, current.month + 1, 0);
int startWeekday = firstDay.weekday;
int totalDays = lastDay.day;
int prevMonthDays = startWeekday - 1;
DateTime prevLastDay = DateTime(current.year, current.month, 0);
for (int i = prevLastDay.day - prevMonthDays + 1; i <= prevLastDay.day; i++) {
monthDays.add(DateTime(current.year, current.month - 1, i));
}
for (int i = 1; i <= totalDays; i++) {
monthDays.add(DateTime(current.year, current.month, i));
}
int nextMonthDays = 42 - monthDays.length;
for (int i = 1; i <= nextMonthDays; i++) {
monthDays.add(DateTime(current.year, current.month + 1, i));
}
return monthDays;
}