mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-28 10:51:44 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			296 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			296 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package cli
 | |
| 
 | |
| import (
 | |
| 	"time"
 | |
| 
 | |
| 	"github.com/pterm/pterm"
 | |
| )
 | |
| 
 | |
| func ColourTime(date time.Time) string {
 | |
| 	dateStr := date.Format("2006-01-02 15:04:05")
 | |
| 	now := time.Now()
 | |
| 
 | |
| 	if date.After(now) {
 | |
| 		dateStr = pterm.LightGreen(dateStr)
 | |
| 	} else {
 | |
| 		dateStr = pterm.LightRed(dateStr)
 | |
| 	}
 | |
| 
 | |
| 	return dateStr
 | |
| }
 |