Browse Source
			 
			
			Feature/Add `wtd` and `mtd` as possible values for date range (#2902 ) 
 
 
			
				* Add `wtd` and `mtd` as possible values for date range
  'wtd': week-to-date (from the start of the week)
  'mtd': month-to-date (from the start of the month)
* Update changelog 
			
			
				 pull/2904/head 
			
			
		 
		
			
				
					
						 
						Cédric Meuter 
					
					2 years ago  
					
						
							 committed by 
							
								 
								GitHub 
							
						 
					
				 
				
			 
		 
		
			
				
					 
					No known key found for this signature in database
					
						
							GPG Key ID:   B5690EEEBB952194 
						
					
				
			
		
		
		
	
		
			
				 4 changed files  with 
20 additions  and 
5 deletions 
			 
			
		 
		
			
				
					
					
					  
					CHANGELOG.md 
				 
			
				
					
					
					  
					apps/api/src/app/portfolio/portfolio.service.ts 
				 
			
				
					
					
					  
					apps/api/src/app/user/update-user-setting.dto.ts 
				 
			
				
					
					
					  
					libs/common/src/lib/types/date-range.type.ts 
				 
			
		 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					### Added 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					- Extended the date range support by week to date (`WTD`) and month to date (`MTD`) in the portfolio service 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					- Added `healthcheck`  for the _Ghostfolio_  service to the `docker-compose`  files (`docker-compose.yml` and `docker-compose.build.yml` ) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					## 2.42.0 - 2024-01-21 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -274,7 +275,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					### Fixed 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					- Handled reading items from missing transaction point while getting the position (`getPosition()`) in portfolio service 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					- Handled reading items from missing transaction point while getting the position (`getPosition()`) in the  portfolio service 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					## 2.24.0 - 2023-11-16 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
						
					 
				
				 
				
					 
				
			 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -73,7 +73,9 @@ import { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  min ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  parseISO ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  set ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  setDayOfYear ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  startOfWeek ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  startOfMonth ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  startOfYear ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  subDays ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  subYears  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					}  from  'date-fns' ;  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -1649,10 +1651,22 @@ export class PortfolioService { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					          subDays ( new  Date ( ) . setHours ( 0 ,  0 ,  0 ,  0 ) ,  1 )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        ] ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        break ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					      case  'mtd' :  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        portfolioStart  =  max ( [  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					          portfolioStart ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					          startOfMonth ( new  Date ( ) . setHours ( 0 ,  0 ,  0 ,  0 ) )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        ] ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        break ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					      case  'wtd' :  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        portfolioStart  =  max ( [  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					          portfolioStart ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					          startOfWeek ( new  Date ( ) . setHours ( 0 ,  0 ,  0 ,  0 ) ,  {  weekStartsOn : 1  } )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        ] ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        break ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					      case  'ytd' :  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        portfolioStart  =  max ( [  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					          portfolioStart ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					          setDayOfYear ( new  Date ( ) . setHours ( 0 ,  0 ,  0 ,  0 ) ,  1 )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					          start OfYear ( new  Date ( ) . setHours ( 0 ,  0 ,  0 ,  0 ) )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        ] ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        break ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					      case  '1y' :  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
						
					 
				
				 
				
					 
				
			 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -30,7 +30,7 @@ export class UpdateUserSettingDto { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  @IsOptional ( )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  colorScheme? : ColorScheme ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  @IsIn ( < DateRange [ ] > [ '1d' ,  '1y' ,  '5y' ,  'max' ,  'ytd' ] )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  @IsIn ( < DateRange [ ] > [ '1d' ,  '1y' ,  '5y' ,  'max' ,  'mtd' ,  'wtd' ,  ' ytd' ] )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  @IsOptional ( )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					  dateRange? : DateRange ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
						
					 
				
				 
				
					 
				
			 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					
						
						
						
					 
				
				 
				
					@ -1 +1 @@ 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					export  type  DateRange  =  '1d'  |  '1y'  |  '5y'  |  'max'  |  'ytd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					export  type  DateRange  =  '1d'  |  '1y'  |  '5y'  |  'max'  |  'mtd'  |  'wtd'  |  ' ytd' ;