support year in relative date format
This commit is contained in:
		
							parent
							
								
									aab735bd39
								
							
						
					
					
						commit
						ec6b10c1f2
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -8,8 +8,15 @@ function formatRelativeTime(date: Date) { | |||
|   const secondsPerMinute = 60; | ||||
|   const minutesPerHour = 60; | ||||
|   const hoursPerDay = 24; | ||||
|   const daysPerMonth = 30; // JS date handling moment
 | ||||
|   const daysPerMonth = 365.2425 / 12; // not how it works!
 | ||||
|   const daysPerYear = 365.2425; // still not how it works!!
 | ||||
|   const intervals = { | ||||
|     year: | ||||
|       millisecondsPerSecond * | ||||
|       secondsPerMinute * | ||||
|       minutesPerHour * | ||||
|       hoursPerDay * | ||||
|       daysPerYear, | ||||
|     month: | ||||
|       millisecondsPerSecond * | ||||
|       secondsPerMinute * | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue