mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-02 18:59:15 -05:00 
			
		
		
		
	fix(mobile): display simple album date when range is single day (#4919)
This change makes albums with same start and end date, to just display a single date. Currently, date range is displayed as `Nov 9 - Nov 9 2023`. With this change, just `Nov 9 2023` is displayed. No changes are made for albums where start and end dates do not match.
This commit is contained in:
		
							parent
							
								
									5e1c0fb465
								
							
						
					
					
						commit
						52fe392a9e
					
				@ -171,11 +171,19 @@ class AlbumViewerPage extends HookConsumerWidget {
 | 
				
			|||||||
        return const SizedBox();
 | 
					        return const SizedBox();
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      final String dateRangeText;
 | 
				
			||||||
 | 
					      if (startDate.day == endDate.day &&
 | 
				
			||||||
 | 
					          startDate.month == endDate.month &&
 | 
				
			||||||
 | 
					          startDate.year == endDate.year) {
 | 
				
			||||||
 | 
					        dateRangeText = DateFormat.yMMMd().format(startDate);
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
        final String startDateText = (startDate.year == endDate.year
 | 
					        final String startDateText = (startDate.year == endDate.year
 | 
				
			||||||
                ? DateFormat.MMMd()
 | 
					                ? DateFormat.MMMd()
 | 
				
			||||||
                : DateFormat.yMMMd())
 | 
					                : DateFormat.yMMMd())
 | 
				
			||||||
            .format(startDate);
 | 
					            .format(startDate);
 | 
				
			||||||
        final String endDateText = DateFormat.yMMMd().format(endDate);
 | 
					        final String endDateText = DateFormat.yMMMd().format(endDate);
 | 
				
			||||||
 | 
					        dateRangeText = "$startDateText - $endDateText";
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return Padding(
 | 
					      return Padding(
 | 
				
			||||||
        padding: EdgeInsets.only(
 | 
					        padding: EdgeInsets.only(
 | 
				
			||||||
@ -183,7 +191,7 @@ class AlbumViewerPage extends HookConsumerWidget {
 | 
				
			|||||||
          bottom: album.shared ? 0.0 : 8.0,
 | 
					          bottom: album.shared ? 0.0 : 8.0,
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
        child: Text(
 | 
					        child: Text(
 | 
				
			||||||
          "$startDateText - $endDateText",
 | 
					          dateRangeText,
 | 
				
			||||||
          style: const TextStyle(
 | 
					          style: const TextStyle(
 | 
				
			||||||
            fontSize: 14,
 | 
					            fontSize: 14,
 | 
				
			||||||
            fontWeight: FontWeight.bold,
 | 
					            fontWeight: FontWeight.bold,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user