summaryrefslogtreecommitdiff
path: root/date.go
blob: 7846283e5478fb2b874636c59223e5867dbb313c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package tree

import (
	"time"
)

// TODO; let the user choose the date format
func MakeDatestamp(t time.Time) string {
	/*
		// Get system locale from the environment
		locale := os.Getenv("LANG")
		if locale == "" {
			locale = "en_US" // Default to English (US) if not set
		}

		// Parse the language tag
		tag, err := language.Parse(locale)
		if err != nil {
			log.Fatalf("Invalid locale: %v", err)
		}

		// Create a date formatter
		formatter := date.NewFormatter(date.OrderDefault, catalog.NewBuilder())

		// Get the current timestamp
		now := time.Now()

		// Format the date based on the locale
		p := message.NewPrinter(tag)
		formattedDate := formatter.Format(tag, now)

		// Print the formatted date
		fmt.Println("Formatted Date:", formattedDate)

		// Alternative: Use predefined time formats
		fmt.Println("Localized Date (fallback):", p.Sprintf("%v", now.Format(time.RFC1123)))
	*/
	return t.Format(time.RFC1123)
}