1package jgo
2
3import (
4	"math"
5	"strconv"
6	"time"
7
8	"github.com/gohugoio/locales"
9	"github.com/gohugoio/locales/currency"
10)
11
12type jgo 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	currencyPositivePrefix string
26	currencyNegativePrefix 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 'jgo' locale
45func New() locales.Translator {
46	return &jgo{
47		locale:                 "jgo",
48		pluralsCardinal:        []locales.PluralRule{2, 6},
49		pluralsOrdinal:         nil,
50		pluralsRange:           nil,
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", "AUD", "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", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CNY", "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", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "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", "MRU", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "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", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UYW", "UZS", "VEB", "VEF", "VES", "VND", "VNN", "VUV", "WST", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
59		currencyPositivePrefix: " ",
60		currencyNegativePrefix: " ",
61		monthsAbbreviated:      []string{"", "Nduŋmbi Saŋ", "Pɛsaŋ Pɛ́pá", "Pɛsaŋ Pɛ́tát", "Pɛsaŋ Pɛ́nɛ́kwa", "Pɛsaŋ Pataa", "Pɛsaŋ Pɛ́nɛ́ntúkú", "Pɛsaŋ Saambá", "Pɛsaŋ Pɛ́nɛ́fɔm", "Pɛsaŋ Pɛ́nɛ́pfúꞋú", "Pɛsaŋ Nɛgɛ́m", "Pɛsaŋ Ntsɔ̌pmɔ́", "Pɛsaŋ Ntsɔ̌ppá"},
62		monthsNarrow:           []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
63		monthsWide:             []string{"", "Nduŋmbi Saŋ", "Pɛsaŋ Pɛ́pá", "Pɛsaŋ Pɛ́tát", "Pɛsaŋ Pɛ́nɛ́kwa", "Pɛsaŋ Pataa", "Pɛsaŋ Pɛ́nɛ́ntúkú", "Pɛsaŋ Saambá", "Pɛsaŋ Pɛ́nɛ́fɔm", "Pɛsaŋ Pɛ́nɛ́pfúꞋú", "Pɛsaŋ Nɛgɛ́m", "Pɛsaŋ Ntsɔ̌pmɔ́", "Pɛsaŋ Ntsɔ̌ppá"},
64		daysAbbreviated:        []string{"Sɔ́ndi", "Mɔ́ndi", "Ápta Mɔ́ndi", "Wɛ́nɛsɛdɛ", "Tɔ́sɛdɛ", "Fɛlâyɛdɛ", "Sásidɛ"},
65		daysNarrow:             []string{"Sɔ́", "Mɔ́", "ÁM", "Wɛ́", "Tɔ́", "Fɛ", "Sá"},
66		daysWide:               []string{"Sɔ́ndi", "Mɔ́ndi", "Ápta Mɔ́ndi", "Wɛ́nɛsɛdɛ", "Tɔ́sɛdɛ", "Fɛlâyɛdɛ", "Sásidɛ"},
67		periodsAbbreviated:     []string{"mbaꞌmbaꞌ", "ŋka mbɔ́t nji"},
68		periodsWide:            []string{"mbaꞌmbaꞌ", "ŋka mbɔ́t nji"},
69		erasAbbreviated:        []string{"BCE", "CE"},
70		erasNarrow:             []string{"", ""},
71		erasWide:               []string{"tsɛttsɛt mɛŋguꞌ mi ɛ́ lɛɛnɛ Kɛlísɛtɔ gɔ ńɔ́", "tsɛttsɛt mɛŋguꞌ mi ɛ́ fúnɛ Kɛlísɛtɔ tɔ́ mɔ́"},
72		timezones:              map[string]string{"ACDT": "ACDT", "ACST": "ACST", "ACWDT": "ACWDT", "ACWST": "ACWST", "ADT": "ADT", "AEDT": "AEDT", "AEST": "AEST", "AKDT": "AKDT", "AKST": "AKST", "ARST": "ARST", "ART": "ART", "AST": "AST", "AWDT": "AWDT", "AWST": "AWST", "BOT": "BOT", "BT": "BT", "CAT": "CAT", "CDT": "CDT", "CHADT": "CHADT", "CHAST": "CHAST", "CLST": "CLST", "CLT": "CLT", "COST": "COST", "COT": "COT", "CST": "CST", "ChST": "ChST", "EAT": "EAT", "ECT": "ECT", "EDT": "EDT", "EST": "EST", "GFT": "GFT", "GMT": "GMT", "GST": "GST", "GYT": "GYT", "HADT": "HADT", "HAST": "HAST", "HAT": "HAT", "HECU": "HECU", "HEEG": "HEEG", "HENOMX": "HENOMX", "HEOG": "HEOG", "HEPM": "HEPM", "HEPMX": "HEPMX", "HKST": "HKST", "HKT": "HKT", "HNCU": "HNCU", "HNEG": "HNEG", "HNNOMX": "HNNOMX", "HNOG": "HNOG", "HNPM": "HNPM", "HNPMX": "HNPMX", "HNT": "HNT", "IST": "IST", "JDT": "JDT", "JST": "JST", "LHDT": "LHDT", "LHST": "LHST", "MDT": "MDT", "MESZ": "MESZ", "MEZ": "MEZ", "MST": "MST", "MYT": "MYT", "NZDT": "NZDT", "NZST": "NZST", "OESZ": "OESZ", "OEZ": "OEZ", "PDT": "PDT", "PST": "PST", "SAST": "SAST", "SGT": "SGT", "SRT": "SRT", "TMST": "TMST", "TMT": "TMT", "UYST": "UYST", "UYT": "UYT", "VET": "VET", "WARST": "WARST", "WART": "WART", "WAST": "WAST", "WAT": "WAT", "WESZ": "WESZ", "WEZ": "WEZ", "WIB": "WIB", "WIT": "WIT", "WITA": "WITA", "∅∅∅": "∅∅∅"},
73	}
74}
75
76// Locale returns the current translators string locale
77func (jgo *jgo) Locale() string {
78	return jgo.locale
79}
80
81// PluralsCardinal returns the list of cardinal plural rules associated with 'jgo'
82func (jgo *jgo) PluralsCardinal() []locales.PluralRule {
83	return jgo.pluralsCardinal
84}
85
86// PluralsOrdinal returns the list of ordinal plural rules associated with 'jgo'
87func (jgo *jgo) PluralsOrdinal() []locales.PluralRule {
88	return jgo.pluralsOrdinal
89}
90
91// PluralsRange returns the list of range plural rules associated with 'jgo'
92func (jgo *jgo) PluralsRange() []locales.PluralRule {
93	return jgo.pluralsRange
94}
95
96// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'jgo'
97func (jgo *jgo) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
98
99	n := math.Abs(num)
100
101	if n == 1 {
102		return locales.PluralRuleOne
103	}
104
105	return locales.PluralRuleOther
106}
107
108// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'jgo'
109func (jgo *jgo) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
110	return locales.PluralRuleUnknown
111}
112
113// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'jgo'
114func (jgo *jgo) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
115	return locales.PluralRuleUnknown
116}
117
118// MonthAbbreviated returns the locales abbreviated month given the 'month' provided
119func (jgo *jgo) MonthAbbreviated(month time.Month) string {
120	return jgo.monthsAbbreviated[month]
121}
122
123// MonthsAbbreviated returns the locales abbreviated months
124func (jgo *jgo) MonthsAbbreviated() []string {
125	return jgo.monthsAbbreviated[1:]
126}
127
128// MonthNarrow returns the locales narrow month given the 'month' provided
129func (jgo *jgo) MonthNarrow(month time.Month) string {
130	return jgo.monthsNarrow[month]
131}
132
133// MonthsNarrow returns the locales narrow months
134func (jgo *jgo) MonthsNarrow() []string {
135	return jgo.monthsNarrow[1:]
136}
137
138// MonthWide returns the locales wide month given the 'month' provided
139func (jgo *jgo) MonthWide(month time.Month) string {
140	return jgo.monthsWide[month]
141}
142
143// MonthsWide returns the locales wide months
144func (jgo *jgo) MonthsWide() []string {
145	return jgo.monthsWide[1:]
146}
147
148// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
149func (jgo *jgo) WeekdayAbbreviated(weekday time.Weekday) string {
150	return jgo.daysAbbreviated[weekday]
151}
152
153// WeekdaysAbbreviated returns the locales abbreviated weekdays
154func (jgo *jgo) WeekdaysAbbreviated() []string {
155	return jgo.daysAbbreviated
156}
157
158// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
159func (jgo *jgo) WeekdayNarrow(weekday time.Weekday) string {
160	return jgo.daysNarrow[weekday]
161}
162
163// WeekdaysNarrow returns the locales narrow weekdays
164func (jgo *jgo) WeekdaysNarrow() []string {
165	return jgo.daysNarrow
166}
167
168// WeekdayShort returns the locales short weekday given the 'weekday' provided
169func (jgo *jgo) WeekdayShort(weekday time.Weekday) string {
170	return jgo.daysShort[weekday]
171}
172
173// WeekdaysShort returns the locales short weekdays
174func (jgo *jgo) WeekdaysShort() []string {
175	return jgo.daysShort
176}
177
178// WeekdayWide returns the locales wide weekday given the 'weekday' provided
179func (jgo *jgo) WeekdayWide(weekday time.Weekday) string {
180	return jgo.daysWide[weekday]
181}
182
183// WeekdaysWide returns the locales wide weekdays
184func (jgo *jgo) WeekdaysWide() []string {
185	return jgo.daysWide
186}
187
188// Decimal returns the decimal point of number
189func (jgo *jgo) Decimal() string {
190	return jgo.decimal
191}
192
193// Group returns the group of number
194func (jgo *jgo) Group() string {
195	return jgo.group
196}
197
198// Group returns the minus sign of number
199func (jgo *jgo) Minus() string {
200	return jgo.minus
201}
202
203// FmtNumber returns 'num' with digits/precision of 'v' for 'jgo' and handles both Whole and Real numbers based on 'v'
204func (jgo *jgo) FmtNumber(num float64, v uint64) string {
205
206	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
208	count := 0
209	inWhole := v == 0
210	b := make([]byte, 0, l)
211
212	for i := len(s) - 1; i >= 0; i-- {
213
214		if s[i] == '.' {
215			b = append(b, jgo.decimal[0])
216			inWhole = true
217			continue
218		}
219
220		if inWhole {
221			if count == 3 {
222				b = append(b, jgo.group[0])
223				count = 1
224			} else {
225				count++
226			}
227		}
228
229		b = append(b, s[i])
230	}
231
232	if num < 0 {
233		b = append(b, jgo.minus[0])
234	}
235
236	// reverse
237	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
238		b[i], b[j] = b[j], b[i]
239	}
240
241	return string(b)
242}
243
244// FmtPercent returns 'num' with digits/precision of 'v' for 'jgo' and handles both Whole and Real numbers based on 'v'
245// NOTE: 'num' passed into FmtPercent is assumed to be in percent already
246func (jgo *jgo) FmtPercent(num float64, v uint64) string {
247	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
248	l := len(s) + 3
249	b := make([]byte, 0, l)
250
251	for i := len(s) - 1; i >= 0; i-- {
252
253		if s[i] == '.' {
254			b = append(b, jgo.decimal[0])
255			continue
256		}
257
258		b = append(b, s[i])
259	}
260
261	if num < 0 {
262		b = append(b, jgo.minus[0])
263	}
264
265	// reverse
266	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
267		b[i], b[j] = b[j], b[i]
268	}
269
270	b = append(b, jgo.percent...)
271
272	return string(b)
273}
274
275// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'jgo'
276func (jgo *jgo) FmtCurrency(num float64, v uint64, currency currency.Type) string {
277
278	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
279	symbol := jgo.currencies[currency]
280	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
281	count := 0
282	inWhole := v == 0
283	b := make([]byte, 0, l)
284
285	for i := len(s) - 1; i >= 0; i-- {
286
287		if s[i] == '.' {
288			b = append(b, jgo.decimal[0])
289			inWhole = true
290			continue
291		}
292
293		if inWhole {
294			if count == 3 {
295				b = append(b, jgo.group[0])
296				count = 1
297			} else {
298				count++
299			}
300		}
301
302		b = append(b, s[i])
303	}
304
305	for j := len(symbol) - 1; j >= 0; j-- {
306		b = append(b, symbol[j])
307	}
308
309	for j := len(jgo.currencyPositivePrefix) - 1; j >= 0; j-- {
310		b = append(b, jgo.currencyPositivePrefix[j])
311	}
312
313	if num < 0 {
314		b = append(b, jgo.minus[0])
315	}
316
317	// reverse
318	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
319		b[i], b[j] = b[j], b[i]
320	}
321
322	if int(v) < 2 {
323
324		if v == 0 {
325			b = append(b, jgo.decimal...)
326		}
327
328		for i := 0; i < 2-int(v); i++ {
329			b = append(b, '0')
330		}
331	}
332
333	return string(b)
334}
335
336// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'jgo'
337// in accounting notation.
338func (jgo *jgo) FmtAccounting(num float64, v uint64, currency currency.Type) string {
339
340	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
341	symbol := jgo.currencies[currency]
342	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
343	count := 0
344	inWhole := v == 0
345	b := make([]byte, 0, l)
346
347	for i := len(s) - 1; i >= 0; i-- {
348
349		if s[i] == '.' {
350			b = append(b, jgo.decimal[0])
351			inWhole = true
352			continue
353		}
354
355		if inWhole {
356			if count == 3 {
357				b = append(b, jgo.group[0])
358				count = 1
359			} else {
360				count++
361			}
362		}
363
364		b = append(b, s[i])
365	}
366
367	if num < 0 {
368
369		for j := len(symbol) - 1; j >= 0; j-- {
370			b = append(b, symbol[j])
371		}
372
373		for j := len(jgo.currencyNegativePrefix) - 1; j >= 0; j-- {
374			b = append(b, jgo.currencyNegativePrefix[j])
375		}
376
377		b = append(b, jgo.minus[0])
378
379	} else {
380
381		for j := len(symbol) - 1; j >= 0; j-- {
382			b = append(b, symbol[j])
383		}
384
385		for j := len(jgo.currencyPositivePrefix) - 1; j >= 0; j-- {
386			b = append(b, jgo.currencyPositivePrefix[j])
387		}
388
389	}
390
391	// reverse
392	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
393		b[i], b[j] = b[j], b[i]
394	}
395
396	if int(v) < 2 {
397
398		if v == 0 {
399			b = append(b, jgo.decimal...)
400		}
401
402		for i := 0; i < 2-int(v); i++ {
403			b = append(b, '0')
404		}
405	}
406
407	return string(b)
408}
409
410// FmtDateShort returns the short date representation of 't' for 'jgo'
411func (jgo *jgo) FmtDateShort(t time.Time) string {
412
413	b := make([]byte, 0, 32)
414
415	if t.Year() > 0 {
416		b = strconv.AppendInt(b, int64(t.Year()), 10)
417	} else {
418		b = strconv.AppendInt(b, int64(-t.Year()), 10)
419	}
420
421	b = append(b, []byte{0x2d}...)
422
423	if t.Month() < 10 {
424		b = append(b, '0')
425	}
426
427	b = strconv.AppendInt(b, int64(t.Month()), 10)
428
429	b = append(b, []byte{0x2d}...)
430
431	if t.Day() < 10 {
432		b = append(b, '0')
433	}
434
435	b = strconv.AppendInt(b, int64(t.Day()), 10)
436
437	return string(b)
438}
439
440// FmtDateMedium returns the medium date representation of 't' for 'jgo'
441func (jgo *jgo) FmtDateMedium(t time.Time) string {
442
443	b := make([]byte, 0, 32)
444
445	if t.Year() > 0 {
446		b = strconv.AppendInt(b, int64(t.Year()), 10)
447	} else {
448		b = strconv.AppendInt(b, int64(-t.Year()), 10)
449	}
450
451	b = append(b, []byte{0x20}...)
452	b = append(b, jgo.monthsAbbreviated[t.Month()]...)
453	b = append(b, []byte{0x20}...)
454	b = strconv.AppendInt(b, int64(t.Day()), 10)
455
456	return string(b)
457}
458
459// FmtDateLong returns the long date representation of 't' for 'jgo'
460func (jgo *jgo) FmtDateLong(t time.Time) string {
461
462	b := make([]byte, 0, 32)
463
464	if t.Year() > 0 {
465		b = strconv.AppendInt(b, int64(t.Year()), 10)
466	} else {
467		b = strconv.AppendInt(b, int64(-t.Year()), 10)
468	}
469
470	b = append(b, []byte{0x20}...)
471	b = append(b, jgo.monthsWide[t.Month()]...)
472	b = append(b, []byte{0x20}...)
473	b = strconv.AppendInt(b, int64(t.Day()), 10)
474
475	return string(b)
476}
477
478// FmtDateFull returns the full date representation of 't' for 'jgo'
479func (jgo *jgo) FmtDateFull(t time.Time) string {
480
481	b := make([]byte, 0, 32)
482
483	b = append(b, jgo.daysWide[t.Weekday()]...)
484	b = append(b, []byte{0x2c, 0x20}...)
485
486	if t.Year() > 0 {
487		b = strconv.AppendInt(b, int64(t.Year()), 10)
488	} else {
489		b = strconv.AppendInt(b, int64(-t.Year()), 10)
490	}
491
492	b = append(b, []byte{0x20}...)
493	b = append(b, jgo.monthsWide[t.Month()]...)
494	b = append(b, []byte{0x20}...)
495
496	if t.Day() < 10 {
497		b = append(b, '0')
498	}
499
500	b = strconv.AppendInt(b, int64(t.Day()), 10)
501
502	return string(b)
503}
504
505// FmtTimeShort returns the short time representation of 't' for 'jgo'
506func (jgo *jgo) FmtTimeShort(t time.Time) string {
507
508	b := make([]byte, 0, 32)
509
510	if t.Hour() < 10 {
511		b = append(b, '0')
512	}
513
514	b = strconv.AppendInt(b, int64(t.Hour()), 10)
515	b = append(b, jgo.timeSeparator...)
516
517	if t.Minute() < 10 {
518		b = append(b, '0')
519	}
520
521	b = strconv.AppendInt(b, int64(t.Minute()), 10)
522
523	return string(b)
524}
525
526// FmtTimeMedium returns the medium time representation of 't' for 'jgo'
527func (jgo *jgo) FmtTimeMedium(t time.Time) string {
528
529	b := make([]byte, 0, 32)
530
531	if t.Hour() < 10 {
532		b = append(b, '0')
533	}
534
535	b = strconv.AppendInt(b, int64(t.Hour()), 10)
536	b = append(b, jgo.timeSeparator...)
537
538	if t.Minute() < 10 {
539		b = append(b, '0')
540	}
541
542	b = strconv.AppendInt(b, int64(t.Minute()), 10)
543	b = append(b, jgo.timeSeparator...)
544
545	if t.Second() < 10 {
546		b = append(b, '0')
547	}
548
549	b = strconv.AppendInt(b, int64(t.Second()), 10)
550
551	return string(b)
552}
553
554// FmtTimeLong returns the long time representation of 't' for 'jgo'
555func (jgo *jgo) FmtTimeLong(t time.Time) string {
556
557	b := make([]byte, 0, 32)
558
559	if t.Hour() < 10 {
560		b = append(b, '0')
561	}
562
563	b = strconv.AppendInt(b, int64(t.Hour()), 10)
564	b = append(b, jgo.timeSeparator...)
565
566	if t.Minute() < 10 {
567		b = append(b, '0')
568	}
569
570	b = strconv.AppendInt(b, int64(t.Minute()), 10)
571	b = append(b, jgo.timeSeparator...)
572
573	if t.Second() < 10 {
574		b = append(b, '0')
575	}
576
577	b = strconv.AppendInt(b, int64(t.Second()), 10)
578	b = append(b, []byte{0x20}...)
579
580	tz, _ := t.Zone()
581	b = append(b, tz...)
582
583	return string(b)
584}
585
586// FmtTimeFull returns the full time representation of 't' for 'jgo'
587func (jgo *jgo) FmtTimeFull(t time.Time) string {
588
589	b := make([]byte, 0, 32)
590
591	if t.Hour() < 10 {
592		b = append(b, '0')
593	}
594
595	b = strconv.AppendInt(b, int64(t.Hour()), 10)
596	b = append(b, jgo.timeSeparator...)
597
598	if t.Minute() < 10 {
599		b = append(b, '0')
600	}
601
602	b = strconv.AppendInt(b, int64(t.Minute()), 10)
603	b = append(b, jgo.timeSeparator...)
604
605	if t.Second() < 10 {
606		b = append(b, '0')
607	}
608
609	b = strconv.AppendInt(b, int64(t.Second()), 10)
610	b = append(b, []byte{0x20}...)
611
612	tz, _ := t.Zone()
613
614	if btz, ok := jgo.timezones[tz]; ok {
615		b = append(b, btz...)
616	} else {
617		b = append(b, tz...)
618	}
619
620	return string(b)
621}
622