diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2020-06-19 14:29:42 +0100 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2020-06-19 14:29:42 +0100 |
| commit | 490615493acc8deb0b29c19cfdcd6ca067760c4b (patch) | |
| tree | 426510ce9ca0bd8b4424e466fb39c1076d0e511f | |
| parent | bcc4cd49ad51d15d890b3f994c9252742d189f98 (diff) | |
add filldates.go
| -rw-r--r-- | internal/server/filldates.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/server/filldates.go b/internal/server/filldates.go new file mode 100644 index 0000000..a6b0ba8 --- /dev/null +++ b/internal/server/filldates.go @@ -0,0 +1,23 @@ +package server + +import ( + "strings" + "time" +) + +func fillDates(str string) string { + yyyesterday := time.Now().Add(3 * -24 * time.Hour).Format("20060102") + str = strings.ReplaceAll(str, "$yyyesterday", yyyesterday) + + yyesterday := time.Now().Add(2 * -24 * time.Hour).Format("20060102") + str = strings.ReplaceAll(str, "$yyesterday", yyesterday) + + yesterday := time.Now().Add(1 * -24 * time.Hour).Format("20060102") + str = strings.ReplaceAll(str, "$yesterday", yesterday) + + today := time.Now().Format("20060102") + str = strings.ReplaceAll(str, "$today", today) + + tomorrow := time.Now().Add(1 * 24 * time.Hour).Format("20060102") + return strings.ReplaceAll(str, "$tomorrow", tomorrow) +} |
