MCPcopy Index your code
hub / github.com/coder/coder / lastReportIntervalHasAtLeastSixDays

Function lastReportIntervalHasAtLeastSixDays

coderd/insights.go:786–794  ·  view source on GitHub ↗
(startTime, endTime time.Time)

Source from the content-addressed store, hash-verified

784}
785
786func lastReportIntervalHasAtLeastSixDays(startTime, endTime time.Time) bool {
787 lastReportIntervalDays := endTime.Sub(startTime) % (7 * 24 * time.Hour)
788 if lastReportIntervalDays == 0 {
789 return true // this is a perfectly full week!
790 }
791 // Ensure that the last interval has at least 6 days, or check the special case, forward DST change,
792 // when the duration can be shorter than 6 days: 5 days 23 hours.
793 return lastReportIntervalDays >= 6*24*time.Hour || startTime.AddDate(0, 0, 6).Equal(endTime)
794}
795
796func templateInsightsSectionAsStrings(sections ...codersdk.TemplateInsightsSection) []string {
797 t := make([]string, len(sections))

Callers 2

parseInsightsIntervalFunction · 0.85

Calls 1

EqualMethod · 0.45

Tested by 1