<commit_before>// timeutil provides a set of time utilities including comparisons,
// conversion to "DT8" int32 and "DT14" int64 formats and other
// capabilities.
package timeutil

import (
	"fmt"
	"strings"
	"time"
)

const (
	DT14               = "20060102150405"
	DT6                = "200601"
	DT8                = "20060102"
	RFC3339Min         = "0000-01-01T00:00:00Z"
	RFC3339Zero        = "0001-01-01T00:00:00Z"
	RFC3339YMD         = "2006-01-02"
	RFC3339YMDZeroUnix = int64(-62135596800)
	ISO8601YM          = "2006-01"
	ISO8601Z2          = "2006-01-02T15:04:05-07"
	ISO8601Z4          = "2006-01-02T15:04:05-0700"
	ISO8601ZCompact    = "20060102T150405Z"
	ISO8601NoTzMilli   = "2006-01-02T15:04:05.000"
)

var FormatMap = map[string]string{
	"RFC3339":    time.RFC3339,
	"RFC3339YMD": RFC3339YMD,
	"ISO8601YM":  ISO8601YM,
}

func GetFormat(formatName string) (string, error) {
	format, ok := FormatMap[strings.TrimSpace(formatName)]
	if !ok {
		return "", fmt.Errorf("Format Not Found: %v", format)
	}
	return format, nil
}

func FormatQuarter(t time.Time) string {
	return fmt.Sprintf("%d Q%d", t.Year(), MonthToQuarter(uint8(t.Month())))
}

func TimeRFC3339Zero() time.Time {<commit_msg>update timeutil.FormatQuarter()<commit_after>// timeutil provides a set of time utilities including comparisons,
// conversion to "DT8" int32 and "DT14" int64 formats and other
// capabilities.
package timeutil

import (
	"fmt"
	"strings"
	"time"
)

const (
	DT14               = "20060102150405"
	DT6                = "200601"
	DT8                = "20060102"
	RFC3339Min         = "0000-01-01T00:00:00Z"
	RFC3339Zero        = "0001-01-01T00:00:00Z"
	RFC3339YMD         = "2006-01-02"
	RFC3339YMDZeroUnix = int64(-62135596800)
	ISO8601YM          = "2006-01"
	ISO8601Z2          = "2006-01-02T15:04:05-07"
	ISO8601Z4          = "2006-01-02T15:04:05-0700"
	ISO8601ZCompact    = "20060102T150405Z"
	ISO8601NoTzMilli   = "2006-01-02T15:04:05.000"
)

var FormatMap = map[string]string{
	"RFC3339":    time.RFC3339,
	"RFC3339YMD": RFC3339YMD,
	"ISO8601YM":  ISO8601YM,
}

func GetFormat(formatName string) (string, error) {
	format, ok := FormatMap[strings.TrimSpace(formatName)]
	if !ok {
		return "", fmt.Errorf("Format Not Found: %v", format)
	}
	return format, nil
}

// FormatQuarter takes quarter time and formats it using "Q# YYYY".
func FormatQuarter(t time.Time) string {
	return fmt.Sprintf("Q%d %d", MonthToQuarter(uint8(t.Month())), t.Year())
}

func TimeRFC3339Zero() time.Time {
{'fraction_non_alphanumeric': 0.13534136546184738, 'fraction_numerical': 0.18152610441767067, 'mean_word_length': 3.229202037351443, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '737005', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1001, 'n_words': 195}