Dev #2
No files matched your search
@@ -40,6 +40,58 @@ func ExtractTags(content string) []string {
|
|||||||
return tags
|
return tags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FormatGermanDateTime formats an ISO-8601 string into "25. Okt. 2026 - 15:40 Uhr"
|
||||||
|
func FormatGermanDateTime(isoStr string) string {
|
||||||
|
if isoStr == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
var t time.Time
|
||||||
|
var err error
|
||||||
|
formats := []string{
|
||||||
|
time.RFC3339Nano,
|
||||||
|
time.RFC3339,
|
||||||
|
"2006-01-02T15:04:05Z07:00",
|
||||||
|
"2006-01-02T15:04:05",
|
||||||
|
"2006-01-02 15:04:05",
|
||||||
|
"2006-01-02",
|
||||||
|
}
|
||||||
|
for _, f := range formats {
|
||||||
|
if parsed, parseErr := time.Parse(f, isoStr); parseErr == nil {
|
||||||
|
t = parsed
|
||||||
|
err = nil
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
err = parseErr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return isoStr
|
||||||
|
}
|
||||||
|
|
||||||
|
t = t.Local()
|
||||||
|
|
||||||
|
germanMonths := map[time.Month]string{
|
||||||
|
time.January: "Jan.",
|
||||||
|
time.February: "Feb.",
|
||||||
|
time.March: "März",
|
||||||
|
time.April: "Apr.",
|
||||||
|
time.May: "Mai",
|
||||||
|
time.June: "Juni",
|
||||||
|
time.July: "Juli",
|
||||||
|
time.August: "Aug.",
|
||||||
|
time.September: "Sept.",
|
||||||
|
time.October: "Okt.",
|
||||||
|
time.November: "Nov.",
|
||||||
|
time.December: "Dez.",
|
||||||
|
}
|
||||||
|
mStr := germanMonths[t.Month()]
|
||||||
|
if mStr == "" {
|
||||||
|
mStr = t.Format("Jan")
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("%d. %s %d - %02d:%02d Uhr", t.Day(), mStr, t.Year(), t.Hour(), t.Minute())
|
||||||
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
|
|||||||
@@ -812,6 +812,17 @@ func (s *Store) UpdateThoughtTriage(userID, thoughtID, action, convertTo, target
|
|||||||
title = title[:72] + "…"
|
title = title[:72] + "…"
|
||||||
}
|
}
|
||||||
blocks := make([]domain.DocumentBlock, 0)
|
blocks := make([]domain.DocumentBlock, 0)
|
||||||
|
formattedDate := domain.FormatGermanDateTime(thought.CreatedAt)
|
||||||
|
calloutText := "Ursprünglicher Gedanke aus deiner Inbox"
|
||||||
|
if formattedDate != "" {
|
||||||
|
calloutText += " vom " + formattedDate
|
||||||
|
}
|
||||||
|
blocks = append(blocks, domain.DocumentBlock{
|
||||||
|
ID: domain.NewID("blk"),
|
||||||
|
Type: "callout",
|
||||||
|
Content: calloutText,
|
||||||
|
Level: 0,
|
||||||
|
})
|
||||||
if strings.TrimSpace(thought.Notes) != "" {
|
if strings.TrimSpace(thought.Notes) != "" {
|
||||||
blocks = append(blocks, domain.DocumentBlock{
|
blocks = append(blocks, domain.DocumentBlock{
|
||||||
ID: domain.NewID("blk"),
|
ID: domain.NewID("blk"),
|
||||||
@@ -831,7 +842,7 @@ func (s *Store) UpdateThoughtTriage(userID, thoughtID, action, convertTo, target
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(blocks) == 0 {
|
if len(blocks) == 1 {
|
||||||
blocks = append(blocks, domain.DocumentBlock{
|
blocks = append(blocks, domain.DocumentBlock{
|
||||||
ID: domain.NewID("blk"),
|
ID: domain.NewID("blk"),
|
||||||
Type: "bullet",
|
Type: "bullet",
|
||||||
|
|||||||
Reference in new issue
Block a user