mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-04-27 15:07:43 +00:00
Defeat Gmail's date detection in the interval summary string.
This commit is contained in:
parent
abb4822197
commit
79462eed54
1 changed files with 8 additions and 2 deletions
|
|
@ -14,7 +14,8 @@ import (
|
||||||
const (
|
const (
|
||||||
CommitDisplayDateFormat = "3:04pm"
|
CommitDisplayDateFormat = "3:04pm"
|
||||||
CommitDisplayDateTooltipFormat = "Monday January 2 3:04pm"
|
CommitDisplayDateTooltipFormat = "Monday January 2 3:04pm"
|
||||||
DigestDisplayDateFormat = "January 2, 2006 was a Monday"
|
DigestDisplayDateFormat = "January 2, 2006"
|
||||||
|
DigestDisplayDayOfWeekFormat = "Monday"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DigestCommit struct {
|
type DigestCommit struct {
|
||||||
|
|
@ -115,8 +116,13 @@ func (digest *IntervalDigest) Description() string {
|
||||||
} else {
|
} else {
|
||||||
formattedRepoCount = fmt.Sprintf("%d repositories", repoCount)
|
formattedRepoCount = fmt.Sprintf("%d repositories", repoCount)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s. You had %s in %s that day.",
|
dayOfWeek := digest.StartTime.Format(DigestDisplayDayOfWeekFormat)
|
||||||
|
// Insert a zero-width space inside the day of the week so that Gmail's
|
||||||
|
// event detection doesn't pick it up.
|
||||||
|
dayOfWeek = fmt.Sprintf("%s\u200B%s", dayOfWeek[:1], dayOfWeek[1:])
|
||||||
|
return fmt.Sprintf("%s was a %s. You had %s in %s that day.",
|
||||||
digest.StartTime.Format(DigestDisplayDateFormat),
|
digest.StartTime.Format(DigestDisplayDateFormat),
|
||||||
|
dayOfWeek,
|
||||||
formattedCommitCount,
|
formattedCommitCount,
|
||||||
formattedRepoCount)
|
formattedRepoCount)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue