1package it
2
3import (
4	"math"
5	"strconv"
6	"time"
7
8	"github.com/go-playground/locales"
9	"github.com/go-playground/locales/currency"
10)
11
12type it struct {
13	locale                 string
14	pluralsCardinal        []locales.PluralRule
15	pluralsOrdinal         []locales.PluralRule
16	pluralsRange           []locales.PluralRule
17	decimal                string
18	group                  string
19	minus                  string
20	percent                string
21	perMille               string
22	timeSeparator          string
23	inifinity              string
24	currencies             []string // idx = enum of currency code
25	currencyPositiveSuffix string
26	currencyNegativeSuffix string
27	monthsAbbreviated      []string
28	monthsNarrow           []string
29	monthsWide             []string
30	daysAbbreviated        []string
31	daysNarrow             []string
32	daysShort              []string
33	daysWide               []string
34	periodsAbbreviated     []string
35	periodsNarrow          []string
36	periodsShort           []string
37	periodsWide            []string
38	erasAbbreviated        []string
39	erasNarrow             []string
40	erasWide               []string
41	timezones              map[string]string
42}
43
44// New returns a new instance of translator for the 'it' locale
45func New() locales.Translator {
46	return &it{
47		locale:                 "it",
48		pluralsCardinal:        []locales.PluralRule{2, 6},
49		pluralsOrdinal:         []locales.PluralRule{5, 6},
50		pluralsRange:           []locales.PluralRule{2, 6},
51		decimal:                ",",
52		group:                  ".",
53		minus:                  "-",
54		percent:                "%",
55		perMille:               "‰",
56		timeSeparator:          ":",
57		inifinity:              "∞",
58		currencies:             []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "A$", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CA$", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CN¥", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "€", "FIM", "FJD", "FKP", "FRF", "£", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "₪", "₹", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZ$", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "STN", "SUR", "SVC", "SYP", "SZL", "฿", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "₫", "VNN", "VUV", "WST", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "EC$", "XDR", "XEU", "XFO", "XFU", "CFA", "XPD", "CFPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
59		currencyPositiveSuffix: " ",
60		currencyNegativeSuffix: " ",
61		monthsAbbreviated:      []string{"", "gen", "feb", "mar", "apr", "mag", "giu", "lug", "ago", "set", "ott", "nov", "dic"},
62		monthsNarrow:           []string{"", "G", "F", "M", "A", "M", "G", "L", "A", "S", "O", "N", "D"},
63		monthsWide:             []string{"", "gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"},
64		daysAbbreviated:        []string{"dom", "lun", "mar", "mer", "gio", "ven", "sab"},
65		daysNarrow:             []string{"D", "L", "M", "M", "G", "V", "S"},
66		daysShort:              []string{"dom", "lun", "mar", "mer", "gio", "ven", "sab"},
67		daysWide:               []string{"domenica", "lunedì", "martedì", "mercoledì", "giovedì", "venerdì", "sabato"},
68		periodsAbbreviated:     []string{"AM", "PM"},
69		periodsNarrow:          []string{"m.", "p."},
70		periodsWide:            []string{"AM", "PM"},
71		erasAbbreviated:        []string{"a.C.", "d.C."},
72		erasNarrow:             []string{"aC", "dC"},
73		erasWide:               []string{"avanti Cristo", "dopo Cristo"},
74		timezones:              map[string]string{"CAT": "Ora dell’Africa centrale", "OEZ": "Ora standard dell’Europa orientale", "AWDT": "Ora legale dell’Australia occidentale", "HEPMX": "Ora legale del Pacifico (Messico)", "JDT": "Ora legale del Giappone", "AKDT": "Ora legale dell’Alaska", "HEOG": "Ora legale della Groenlandia occidentale", "HNT": "Ora standard di Terranova", "CST": "Ora standard centrale USA", "CDT": "Ora legale centrale USA", "ADT": "Ora legale dell’Atlantico", "HEPM": "Ora legale di Saint-Pierre e Miquelon", "CLT": "Ora standard del Cile", "UYST": "Ora legale dell’Uruguay", "LHST": "Ora standard di Lord Howe", "WART": "Ora standard dell’Argentina occidentale", "IST": "Ora standard dell’India", "EAT": "Ora dell’Africa orientale", "MDT": "Ora legale Montagne Rocciose USA", "WAST": "Ora legale dell’Africa occidentale", "HKT": "Ora standard di Hong Kong", "HNEG": "Ora standard della Groenlandia orientale", "CHAST": "Ora standard delle Chatham", "WESZ": "Ora legale dell’Europa occidentale", "BT": "Ora del Bhutan", "HNPM": "Ora standard di Saint-Pierre e Miquelon", "TMT": "Ora standard del Turkmenistan", "AEDT": "Ora legale dell’Australia orientale", "GFT": "Ora della Guiana francese", "EST": "Ora standard orientale USA", "AKST": "Ora standard dell’Alaska", "EDT": "Ora legale orientale USA", "HEEG": "Ora legale della Groenlandia orientale", "HAT": "Ora legale di Terranova", "HNNOMX": "Ora standard del Messico nord-occidentale", "∅∅∅": "Ora legale di Brasilia", "JST": "Ora standard del Giappone", "NZDT": "Ora legale della Nuova Zelanda", "BOT": "Ora della Bolivia", "COT": "Ora standard della Colombia", "OESZ": "Ora legale dell’Europa orientale", "ARST": "Ora legale dell’Argentina", "PST": "Ora standard del Pacifico USA", "PDT": "Ora legale del Pacifico USA", "TMST": "Ora legale del Turkmenistan", "ECT": "Ora dell’Ecuador", "MESZ": "Ora legale dell’Europa centrale", "SRT": "Ora del Suriname", "CLST": "Ora legale del Cile", "ART": "Ora standard dell’Argentina", "GMT": "Ora del meridiano di Greenwich", "GYT": "Ora della Guyana", "MYT": "Ora della Malesia", "HENOMX": "Ora legale del Messico nord-occidentale", "WEZ": "Ora standard dell’Europa occidentale", "WIB": "Ora dell’Indonesia occidentale", "VET": "Ora del Venezuela", "MST": "Ora standard Montagne Rocciose USA", "AEST": "Ora standard dell’Australia orientale", "ACWST": "Ora standard dell’Australia centroccidentale", "MEZ": "Ora standard dell’Europa centrale", "HKST": "Ora legale di Hong Kong", "LHDT": "Ora legale di Lord Howe", "COST": "Ora legale della Colombia", "ChST": "Ora di Chamorro", "AST": "Ora standard dell’Atlantico", "HNOG": "Ora standard della Groenlandia occidentale", "WAT": "Ora standard dell’Africa occidentale", "WARST": "Ora legale dell’Argentina occidentale", "HAST": "Ora standard delle Isole Hawaii-Aleutine", "CHADT": "Ora legale delle Chatham", "HNCU": "Ora standard di Cuba", "HECU": "Ora legale di Cuba", "SAST": "Ora dell’Africa meridionale", "NZST": "Ora standard della Nuova Zelanda", "SGT": "Ora di Singapore", "ACST": "Ora standard dell’Australia centrale", "ACDT": "Ora legale dell’Australia centrale", "UYT": "Ora standard dell’Uruguay", "AWST": "Ora standard dell’Australia occidentale", "HNPMX": "Ora standard del Pacifico (Messico)", "HADT": "Ora legale delle Isole Hawaii-Aleutine", "ACWDT": "Ora legale dell’Australia centroccidentale", "WITA": "Ora dell’Indonesia centrale", "WIT": "Ora dell’Indonesia orientale"},
75	}
76}
77
78// Locale returns the current translators string locale
79func (it *it) Locale() string {
80	return it.locale
81}
82
83// PluralsCardinal returns the list of cardinal plural rules associated with 'it'
84func (it *it) PluralsCardinal() []locales.PluralRule {
85	return it.pluralsCardinal
86}
87
88// PluralsOrdinal returns the list of ordinal plural rules associated with 'it'
89func (it *it) PluralsOrdinal() []locales.PluralRule {
90	return it.pluralsOrdinal
91}
92
93// PluralsRange returns the list of range plural rules associated with 'it'
94func (it *it) PluralsRange() []locales.PluralRule {
95	return it.pluralsRange
96}
97
98// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'it'
99func (it *it) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
100
101	n := math.Abs(num)
102	i := int64(n)
103
104	if i == 1 && v == 0 {
105		return locales.PluralRuleOne
106	}
107
108	return locales.PluralRuleOther
109}
110
111// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'it'
112func (it *it) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
113
114	n := math.Abs(num)
115
116	if n == 11 || n == 8 || n == 80 || n == 800 {
117		return locales.PluralRuleMany
118	}
119
120	return locales.PluralRuleOther
121}
122
123// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'it'
124func (it *it) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
125
126	start := it.CardinalPluralRule(num1, v1)
127	end := it.CardinalPluralRule(num2, v2)
128
129	if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
130		return locales.PluralRuleOther
131	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
132		return locales.PluralRuleOne
133	}
134
135	return locales.PluralRuleOther
136
137}
138
139// MonthAbbreviated returns the locales abbreviated month given the 'month' provided
140func (it *it) MonthAbbreviated(month time.Month) string {
141	return it.monthsAbbreviated[month]
142}
143
144// MonthsAbbreviated returns the locales abbreviated months
145func (it *it) MonthsAbbreviated() []string {
146	return it.monthsAbbreviated[1:]
147}
148
149// MonthNarrow returns the locales narrow month given the 'month' provided
150func (it *it) MonthNarrow(month time.Month) string {
151	return it.monthsNarrow[month]
152}
153
154// MonthsNarrow returns the locales narrow months
155func (it *it) MonthsNarrow() []string {
156	return it.monthsNarrow[1:]
157}
158
159// MonthWide returns the locales wide month given the 'month' provided
160func (it *it) MonthWide(month time.Month) string {
161	return it.monthsWide[month]
162}
163
164// MonthsWide returns the locales wide months
165func (it *it) MonthsWide() []string {
166	return it.monthsWide[1:]
167}
168
169// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
170func (it *it) WeekdayAbbreviated(weekday time.Weekday) string {
171	return it.daysAbbreviated[weekday]
172}
173
174// WeekdaysAbbreviated returns the locales abbreviated weekdays
175func (it *it) WeekdaysAbbreviated() []string {
176	return it.daysAbbreviated
177}
178
179// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
180func (it *it) WeekdayNarrow(weekday time.Weekday) string {
181	return it.daysNarrow[weekday]
182}
183
184// WeekdaysNarrow returns the locales narrow weekdays
185func (it *it) WeekdaysNarrow() []string {
186	return it.daysNarrow
187}
188
189// WeekdayShort returns the locales short weekday given the 'weekday' provided
190func (it *it) WeekdayShort(weekday time.Weekday) string {
191	return it.daysShort[weekday]
192}
193
194// WeekdaysShort returns the locales short weekdays
195func (it *it) WeekdaysShort() []string {
196	return it.daysShort
197}
198
199// WeekdayWide returns the locales wide weekday given the 'weekday' provided
200func (it *it) WeekdayWide(weekday time.Weekday) string {
201	return it.daysWide[weekday]
202}
203
204// WeekdaysWide returns the locales wide weekdays
205func (it *it) WeekdaysWide() []string {
206	return it.daysWide
207}
208
209// Decimal returns the decimal point of number
210func (it *it) Decimal() string {
211	return it.decimal
212}
213
214// Group returns the group of number
215func (it *it) Group() string {
216	return it.group
217}
218
219// Group returns the minus sign of number
220func (it *it) Minus() string {
221	return it.minus
222}
223
224// FmtNumber returns 'num' with digits/precision of 'v' for 'it' and handles both Whole and Real numbers based on 'v'
225func (it *it) FmtNumber(num float64, v uint64) string {
226
227	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
228	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
229	count := 0
230	inWhole := v == 0
231	b := make([]byte, 0, l)
232
233	for i := len(s) - 1; i >= 0; i-- {
234
235		if s[i] == '.' {
236			b = append(b, it.decimal[0])
237			inWhole = true
238			continue
239		}
240
241		if inWhole {
242			if count == 3 {
243				b = append(b, it.group[0])
244				count = 1
245			} else {
246				count++
247			}
248		}
249
250		b = append(b, s[i])
251	}
252
253	if num < 0 {
254		b = append(b, it.minus[0])
255	}
256
257	// reverse
258	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
259		b[i], b[j] = b[j], b[i]
260	}
261
262	return string(b)
263}
264
265// FmtPercent returns 'num' with digits/precision of 'v' for 'it' and handles both Whole and Real numbers based on 'v'
266// NOTE: 'num' passed into FmtPercent is assumed to be in percent already
267func (it *it) FmtPercent(num float64, v uint64) string {
268	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
269	l := len(s) + 3
270	b := make([]byte, 0, l)
271
272	for i := len(s) - 1; i >= 0; i-- {
273
274		if s[i] == '.' {
275			b = append(b, it.decimal[0])
276			continue
277		}
278
279		b = append(b, s[i])
280	}
281
282	if num < 0 {
283		b = append(b, it.minus[0])
284	}
285
286	// reverse
287	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
288		b[i], b[j] = b[j], b[i]
289	}
290
291	b = append(b, it.percent...)
292
293	return string(b)
294}
295
296// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'it'
297func (it *it) FmtCurrency(num float64, v uint64, currency currency.Type) string {
298
299	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
300	symbol := it.currencies[currency]
301	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
302	count := 0
303	inWhole := v == 0
304	b := make([]byte, 0, l)
305
306	for i := len(s) - 1; i >= 0; i-- {
307
308		if s[i] == '.' {
309			b = append(b, it.decimal[0])
310			inWhole = true
311			continue
312		}
313
314		if inWhole {
315			if count == 3 {
316				b = append(b, it.group[0])
317				count = 1
318			} else {
319				count++
320			}
321		}
322
323		b = append(b, s[i])
324	}
325
326	if num < 0 {
327		b = append(b, it.minus[0])
328	}
329
330	// reverse
331	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
332		b[i], b[j] = b[j], b[i]
333	}
334
335	if int(v) < 2 {
336
337		if v == 0 {
338			b = append(b, it.decimal...)
339		}
340
341		for i := 0; i < 2-int(v); i++ {
342			b = append(b, '0')
343		}
344	}
345
346	b = append(b, it.currencyPositiveSuffix...)
347
348	b = append(b, symbol...)
349
350	return string(b)
351}
352
353// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'it'
354// in accounting notation.
355func (it *it) FmtAccounting(num float64, v uint64, currency currency.Type) string {
356
357	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
358	symbol := it.currencies[currency]
359	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
360	count := 0
361	inWhole := v == 0
362	b := make([]byte, 0, l)
363
364	for i := len(s) - 1; i >= 0; i-- {
365
366		if s[i] == '.' {
367			b = append(b, it.decimal[0])
368			inWhole = true
369			continue
370		}
371
372		if inWhole {
373			if count == 3 {
374				b = append(b, it.group[0])
375				count = 1
376			} else {
377				count++
378			}
379		}
380
381		b = append(b, s[i])
382	}
383
384	if num < 0 {
385
386		b = append(b, it.minus[0])
387
388	}
389
390	// reverse
391	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
392		b[i], b[j] = b[j], b[i]
393	}
394
395	if int(v) < 2 {
396
397		if v == 0 {
398			b = append(b, it.decimal...)
399		}
400
401		for i := 0; i < 2-int(v); i++ {
402			b = append(b, '0')
403		}
404	}
405
406	if num < 0 {
407		b = append(b, it.currencyNegativeSuffix...)
408		b = append(b, symbol...)
409	} else {
410
411		b = append(b, it.currencyPositiveSuffix...)
412		b = append(b, symbol...)
413	}
414
415	return string(b)
416}
417
418// FmtDateShort returns the short date representation of 't' for 'it'
419func (it *it) FmtDateShort(t time.Time) string {
420
421	b := make([]byte, 0, 32)
422
423	if t.Day() < 10 {
424		b = append(b, '0')
425	}
426
427	b = strconv.AppendInt(b, int64(t.Day()), 10)
428	b = append(b, []byte{0x2f}...)
429
430	if t.Month() < 10 {
431		b = append(b, '0')
432	}
433
434	b = strconv.AppendInt(b, int64(t.Month()), 10)
435
436	b = append(b, []byte{0x2f}...)
437
438	if t.Year() > 9 {
439		b = append(b, strconv.Itoa(t.Year())[2:]...)
440	} else {
441		b = append(b, strconv.Itoa(t.Year())[1:]...)
442	}
443
444	return string(b)
445}
446
447// FmtDateMedium returns the medium date representation of 't' for 'it'
448func (it *it) FmtDateMedium(t time.Time) string {
449
450	b := make([]byte, 0, 32)
451
452	b = strconv.AppendInt(b, int64(t.Day()), 10)
453	b = append(b, []byte{0x20}...)
454	b = append(b, it.monthsAbbreviated[t.Month()]...)
455	b = append(b, []byte{0x20}...)
456
457	if t.Year() > 0 {
458		b = strconv.AppendInt(b, int64(t.Year()), 10)
459	} else {
460		b = strconv.AppendInt(b, int64(-t.Year()), 10)
461	}
462
463	return string(b)
464}
465
466// FmtDateLong returns the long date representation of 't' for 'it'
467func (it *it) FmtDateLong(t time.Time) string {
468
469	b := make([]byte, 0, 32)
470
471	b = strconv.AppendInt(b, int64(t.Day()), 10)
472	b = append(b, []byte{0x20}...)
473	b = append(b, it.monthsWide[t.Month()]...)
474	b = append(b, []byte{0x20}...)
475
476	if t.Year() > 0 {
477		b = strconv.AppendInt(b, int64(t.Year()), 10)
478	} else {
479		b = strconv.AppendInt(b, int64(-t.Year()), 10)
480	}
481
482	return string(b)
483}
484
485// FmtDateFull returns the full date representation of 't' for 'it'
486func (it *it) FmtDateFull(t time.Time) string {
487
488	b := make([]byte, 0, 32)
489
490	b = append(b, it.daysWide[t.Weekday()]...)
491	b = append(b, []byte{0x20}...)
492	b = strconv.AppendInt(b, int64(t.Day()), 10)
493	b = append(b, []byte{0x20}...)
494	b = append(b, it.monthsWide[t.Month()]...)
495	b = append(b, []byte{0x20}...)
496
497	if t.Year() > 0 {
498		b = strconv.AppendInt(b, int64(t.Year()), 10)
499	} else {
500		b = strconv.AppendInt(b, int64(-t.Year()), 10)
501	}
502
503	return string(b)
504}
505
506// FmtTimeShort returns the short time representation of 't' for 'it'
507func (it *it) FmtTimeShort(t time.Time) string {
508
509	b := make([]byte, 0, 32)
510
511	if t.Hour() < 10 {
512		b = append(b, '0')
513	}
514
515	b = strconv.AppendInt(b, int64(t.Hour()), 10)
516	b = append(b, it.timeSeparator...)
517
518	if t.Minute() < 10 {
519		b = append(b, '0')
520	}
521
522	b = strconv.AppendInt(b, int64(t.Minute()), 10)
523
524	return string(b)
525}
526
527// FmtTimeMedium returns the medium time representation of 't' for 'it'
528func (it *it) FmtTimeMedium(t time.Time) string {
529
530	b := make([]byte, 0, 32)
531
532	if t.Hour() < 10 {
533		b = append(b, '0')
534	}
535
536	b = strconv.AppendInt(b, int64(t.Hour()), 10)
537	b = append(b, it.timeSeparator...)
538
539	if t.Minute() < 10 {
540		b = append(b, '0')
541	}
542
543	b = strconv.AppendInt(b, int64(t.Minute()), 10)
544	b = append(b, it.timeSeparator...)
545
546	if t.Second() < 10 {
547		b = append(b, '0')
548	}
549
550	b = strconv.AppendInt(b, int64(t.Second()), 10)
551
552	return string(b)
553}
554
555// FmtTimeLong returns the long time representation of 't' for 'it'
556func (it *it) FmtTimeLong(t time.Time) string {
557
558	b := make([]byte, 0, 32)
559
560	if t.Hour() < 10 {
561		b = append(b, '0')
562	}
563
564	b = strconv.AppendInt(b, int64(t.Hour()), 10)
565	b = append(b, it.timeSeparator...)
566
567	if t.Minute() < 10 {
568		b = append(b, '0')
569	}
570
571	b = strconv.AppendInt(b, int64(t.Minute()), 10)
572	b = append(b, it.timeSeparator...)
573
574	if t.Second() < 10 {
575		b = append(b, '0')
576	}
577
578	b = strconv.AppendInt(b, int64(t.Second()), 10)
579	b = append(b, []byte{0x20}...)
580
581	tz, _ := t.Zone()
582	b = append(b, tz...)
583
584	return string(b)
585}
586
587// FmtTimeFull returns the full time representation of 't' for 'it'
588func (it *it) FmtTimeFull(t time.Time) string {
589
590	b := make([]byte, 0, 32)
591
592	if t.Hour() < 10 {
593		b = append(b, '0')
594	}
595
596	b = strconv.AppendInt(b, int64(t.Hour()), 10)
597	b = append(b, it.timeSeparator...)
598
599	if t.Minute() < 10 {
600		b = append(b, '0')
601	}
602
603	b = strconv.AppendInt(b, int64(t.Minute()), 10)
604	b = append(b, it.timeSeparator...)
605
606	if t.Second() < 10 {
607		b = append(b, '0')
608	}
609
610	b = strconv.AppendInt(b, int64(t.Second()), 10)
611	b = append(b, []byte{0x20}...)
612
613	tz, _ := t.Zone()
614
615	if btz, ok := it.timezones[tz]; ok {
616		b = append(b, btz...)
617	} else {
618		b = append(b, tz...)
619	}
620
621	return string(b)
622}
623