Skip to content
Snippets Groups Projects
Commit f8185d7c authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

upddate: last updated date format

parent 8f9ba552
No related branches found
No related tags found
1 merge request!11Clhp map
......@@ -16,8 +16,8 @@ Uint8List selectedRelation = Uint8List(0);
List<Measurement> selectedMarkerList = [];
LatLng mapCenter = LatLng(60.8000, 10.8471);
DateTime ?lastUpdate; // Last time data was fetched from server
List<String> lakeSearchOptions = []; // Init empty
bool internetConnection = true;
// Font settings
const textColor = Colors.white;
......
......@@ -72,6 +72,7 @@ class _BarDataState extends State<BarData> {
);
}
// _buildLegendItem renders a colored circle and text to form a legend
Widget _buildLegendItem(Color color, String text) {
return Row(
children: [
......
......@@ -208,7 +208,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
lastUpdate?.month == DateTime.now().month &&
lastUpdate?.year == DateTime.now().year ?
'${lastUpdate?.hour}:${lastUpdate?.minute}' :
'${lastUpdate?.day}-${lastUpdate?.month}-${lastUpdate?.year}') : ''}',
'${lastUpdate?.day}.${formatMonth(lastUpdate!.month)} ${lastUpdate?.year}') : ''}',
style: GoogleFonts.dmSans(
fontSize: 14,
color: Colors.white60,
......@@ -303,3 +303,34 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
);
}
}
String formatMonth(int month) {
switch (month) {
case 1:
return 'Jan';
case 2:
return 'Feb';
case 3:
return 'Mar';
case 4:
return 'Apr';
case 5:
return 'May';
case 6:
return 'Jun';
case 7:
return 'Jul';
case 8:
return 'Aug';
case 9:
return 'Sep';
case 10:
return 'Oct';
case 11:
return 'Nov';
case 12:
return 'Dec';
default:
return '';
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment