mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	Fixed mobile timeline crash when date group cannot be parsed (#530)
* Handle error when datetime is incorrect * Added better debug message
This commit is contained in:
		@@ -65,37 +65,45 @@ class HomePage extends HookConsumerWidget {
 | 
				
			|||||||
        int? lastMonth;
 | 
					        int? lastMonth;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assetGroupByDateTime.forEach((dateGroup, immichAssetList) {
 | 
					        assetGroupByDateTime.forEach((dateGroup, immichAssetList) {
 | 
				
			||||||
          DateTime parseDateGroup = DateTime.parse(dateGroup);
 | 
					          try {
 | 
				
			||||||
          int currentMonth = parseDateGroup.month;
 | 
					            DateTime parseDateGroup = DateTime.parse(dateGroup);
 | 
				
			||||||
 | 
					            int currentMonth = parseDateGroup.month;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          if (lastMonth != null) {
 | 
					            if (lastMonth != null) {
 | 
				
			||||||
            if (currentMonth - lastMonth! != 0) {
 | 
					              if (currentMonth - lastMonth! != 0) {
 | 
				
			||||||
              imageGridGroup.add(
 | 
					                imageGridGroup.add(
 | 
				
			||||||
                MonthlyTitleText(
 | 
					                  MonthlyTitleText(
 | 
				
			||||||
                  isoDate: dateGroup,
 | 
					                    isoDate: dateGroup,
 | 
				
			||||||
                ),
 | 
					                  ),
 | 
				
			||||||
              );
 | 
					                );
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            imageGridGroup.add(
 | 
				
			||||||
 | 
					              DailyTitleText(
 | 
				
			||||||
 | 
					                key: Key('${dateGroup.toString()}title'),
 | 
				
			||||||
 | 
					                isoDate: dateGroup,
 | 
				
			||||||
 | 
					                assetGroup: immichAssetList,
 | 
				
			||||||
 | 
					              ),
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            imageGridGroup.add(
 | 
				
			||||||
 | 
					              ImageGrid(
 | 
				
			||||||
 | 
					                assetGroup: immichAssetList,
 | 
				
			||||||
 | 
					                sortedAssetGroup: sortedAssetList,
 | 
				
			||||||
 | 
					                tilesPerRow:
 | 
				
			||||||
 | 
					                    appSettingService.getSetting(AppSettingsEnum.tilesPerRow),
 | 
				
			||||||
 | 
					                showStorageIndicator: appSettingService
 | 
				
			||||||
 | 
					                    .getSetting(AppSettingsEnum.storageIndicator),
 | 
				
			||||||
 | 
					              ),
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            lastMonth = currentMonth;
 | 
				
			||||||
 | 
					          } catch (e) {
 | 
				
			||||||
 | 
					            debugPrint(
 | 
				
			||||||
 | 
					              "[ERROR] Cannot parse $dateGroup - Wrong create date format : ${immichAssetList.map((asset) => asset.createdAt).toList()}",
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					 | 
				
			||||||
          imageGridGroup.add(
 | 
					 | 
				
			||||||
            DailyTitleText(
 | 
					 | 
				
			||||||
              key: Key('${dateGroup.toString()}title'),
 | 
					 | 
				
			||||||
              isoDate: dateGroup,
 | 
					 | 
				
			||||||
              assetGroup: immichAssetList,
 | 
					 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
          );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          imageGridGroup.add(
 | 
					 | 
				
			||||||
            ImageGrid(
 | 
					 | 
				
			||||||
              assetGroup: immichAssetList,
 | 
					 | 
				
			||||||
              sortedAssetGroup: sortedAssetList,
 | 
					 | 
				
			||||||
              tilesPerRow: appSettingService.getSetting(AppSettingsEnum.tilesPerRow),
 | 
					 | 
				
			||||||
              showStorageIndicator: appSettingService.getSetting(AppSettingsEnum.storageIndicator),
 | 
					 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
          );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          lastMonth = currentMonth;
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user