Implement more sophisticated updateDateTime function

This commit is contained in:
2024-10-20 15:37:03 +02:00
parent ee72e91593
commit da5d955b2d
3 changed files with 33 additions and 23 deletions

10
atom.go
View File

@@ -7,6 +7,7 @@ import (
"mime"
"regexp"
"strings"
"time"
"github.com/google/uuid"
"golang.org/x/text/language"
@@ -109,6 +110,15 @@ func isValidAttribute(attribute string) bool {
return regex.MatchString(attribute)
}
// update updates the Date
func updateDateTime(d *Date) {
if d == nil {
d = NewDate(time.Now())
} else {
d.DateTime = DateTime(time.Now())
}
}
// NewURN generates an new valid IRI based on a UUID. It returns an IRI.
func NewURN() string {
return fmt.Sprint("urn:uuid:", uuid.New())