1 package az
2
3 import (
4 "math"
5 "strconv"
6 "time"
7
8 "github.com/go-playground/locales"
9 "github.com/go-playground/locales/currency"
10 )
11
12 type az 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
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
45 func New() locales.Translator {
46 return &az{
47 locale: "az",
48 pluralsCardinal: []locales.PluralRule{2, 6},
49 pluralsOrdinal: []locales.PluralRule{2, 4, 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", "₼", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "R$", "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", "HK$", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "₪", "₹", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JP¥", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "₩", "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", "MX$", "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", "NT$", "TZS", "UAH", "UAK", "UGS", "UGX", "US$", "USN", "USS", "UYI", "UYP", "UYU", "UYW", "UZS", "VEB", "VEF", "VES", "₫", "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{"", "yan", "fev", "mar", "apr", "may", "iyn", "iyl", "avq", "sen", "okt", "noy", "dek"},
62 monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
63 monthsWide: []string{"", "yanvar", "fevral", "mart", "aprel", "may", "iyun", "iyul", "avqust", "sentyabr", "oktyabr", "noyabr", "dekabr"},
64 daysAbbreviated: []string{"B.", "B.e.", "Ç.a.", "Ç.", "C.a.", "C.", "Ş."},
65 daysNarrow: []string{"7", "1", "2", "3", "4", "5", "6"},
66 daysShort: []string{"B.", "B.E.", "Ç.A.", "Ç.", "C.A.", "C.", "Ş."},
67 daysWide: []string{"bazar", "bazar ertəsi", "çərşənbə axşamı", "çərşənbə", "cümə axşamı", "cümə", "şənbə"},
68 periodsAbbreviated: []string{"AM", "PM"},
69 periodsNarrow: []string{"a", "p"},
70 periodsWide: []string{"AM", "PM"},
71 erasAbbreviated: []string{"e.ə.", "y.e."},
72 erasNarrow: []string{"", ""},
73 erasWide: []string{"eramızdan əvvəl", "yeni era"},
74 timezones: map[string]string{"ACDT": "Mərkəzi Avstraliya Yay Vaxtı", "ACST": "Mərkəzi Avstraliya Standart Vaxtı", "ACWDT": "Mərkəzi Qərbi Avstraliya Yay Vaxtı", "ACWST": "Mərkəzi Qərbi Avstraliya Standart Vaxtı", "ADT": "Atlantik Yay Vaxtı", "AEDT": "Şərqi Avstraliya Yay Vaxtı", "AEST": "Şərqi Avstraliya Standart Vaxtı", "AKDT": "Alyaska Yay Vaxtı", "AKST": "Alyaska Standart Vaxtı", "ARST": "Argentina Yay Vaxtı", "ART": "Argentina Standart Vaxtı", "AST": "Atlantik Standart Vaxt", "AWDT": "Qərbi Avstraliya Yay Vaxtı", "AWST": "Qərbi Avstraliya Standart Vaxtı", "BOT": "Boliviya Vaxtı", "BT": "Butan Vaxtı", "CAT": "Mərkəzi Afrika Vaxtı", "CDT": "Şimali Mərkəzi Amerika Yay Vaxtı", "CHADT": "Çatham Yay Vaxtı", "CHAST": "Çatham Standart Vaxtı", "CLST": "Çili Yay Vaxtı", "CLT": "Çili Standart Vaxtı", "COST": "Kolumbiya Yay Vaxtı", "COT": "Kolumbiya Standart Vaxtı", "CST": "Şimali Mərkəzi Amerika Standart Vaxtı", "ChST": "Çamorro Vaxtı", "EAT": "Şərqi Afrika Vaxtı", "ECT": "Ekvador Vaxtı", "EDT": "Şimali Şərqi Amerika Yay Vaxtı", "EST": "Şimali Şərqi Amerika Standart Vaxtı", "GFT": "Fransız Qvianası Vaxtı", "GMT": "Qrinviç Orta Vaxtı", "GST": "Körfəz Vaxtı", "GYT": "Qayana Vaxtı", "HADT": "Havay-Aleut Yay Vaxtı", "HAST": "Havay-Aleut Standart Vaxtı", "HAT": "Nyufaundlend Yay Vaxtı", "HECU": "Kuba Yay Vaxtı", "HEEG": "Şərqi Qrenlandiya Yay Vaxtı", "HENOMX": "Şimal-Qərbi Meksika Yay Vaxtı", "HEOG": "Qərbi Qrenlandiya Yay Vaxtı", "HEPM": "Müqəddəs Pyer və Mikelon Yay Vaxtı", "HEPMX": "Meksika Sakit Okean Yay Vaxtı", "HKST": "Honq Konq Yay Vaxtı", "HKT": "Honq Konq Standart Vaxtı", "HNCU": "Kuba Standart Vaxtı", "HNEG": "Şərqi Qrenlandiya Standart Vaxtı", "HNNOMX": "Şimal-Qərbi Meksika Standart Vaxtı", "HNOG": "Qərbi Qrenlandiya Standart Vaxtı", "HNPM": "Müqəddəs Pyer və Mikelon Standart Vaxtı", "HNPMX": "Meksika Sakit Okean Standart Vaxtı", "HNT": "Nyufaundlend Standart Vaxtı", "IST": "Hindistan Vaxtı", "JDT": "Yaponiya Yay Vaxtı", "JST": "Yaponiya Standart Vaxtı", "LHDT": "Lord Hau Yay vaxtı", "LHST": "Lord Hau Standart Vaxtı", "MDT": "Şimali Dağlıq Amerika Yay Vaxtı", "MESZ": "Mərkəzi Avropa Yay Vaxtı", "MEZ": "Mərkəzi Avropa Standart Vaxtı", "MST": "Şimali Dağlıq Amerika Standart Vaxtı", "MYT": "Malayziya Vaxtı", "NZDT": "Yeni Zelandiya Yay Vaxtı", "NZST": "Yeni Zelandiya Standart Vaxtı", "OESZ": "Şərqi Avropa Yay Vaxtı", "OEZ": "Şərqi Avropa Standart Vaxtı", "PDT": "Şimali Amerika Sakit Okean Yay Vaxtı", "PST": "Şimali Amerika Sakit Okean Standart Vaxtı", "SAST": "Cənubi Afrika Vaxtı", "SGT": "Sinqapur Vaxtı", "SRT": "Surinam Vaxtı", "TMST": "Türkmənistan Yay Vaxtı", "TMT": "Türkmənistan Standart Vaxtı", "UYST": "Uruqvay Yay Vaxtı", "UYT": "Uruqvay Standart Vaxtı", "VET": "Venesuela Vaxtı", "WARST": "Qərbi Argentina Yay Vaxtı", "WART": "Qərbi Argentina Standart Vaxtı", "WAST": "Qərbi Afrika Yay Vaxtı", "WAT": "Qərbi Afrika Standart Vaxtı", "WESZ": "Qərbi Avropa Yay Vaxtı", "WEZ": "Qərbi Avropa Standart Vaxtı", "WIB": "Qərbi İndoneziya Vaxtı", "WIT": "Şərqi İndoneziya Vaxtı", "WITA": "Mərkəzi İndoneziya Vaxtı", "∅∅∅": "Braziliya Yay Vaxtı"},
75 }
76 }
77
78
79 func (az *az) Locale() string {
80 return az.locale
81 }
82
83
84 func (az *az) PluralsCardinal() []locales.PluralRule {
85 return az.pluralsCardinal
86 }
87
88
89 func (az *az) PluralsOrdinal() []locales.PluralRule {
90 return az.pluralsOrdinal
91 }
92
93
94 func (az *az) PluralsRange() []locales.PluralRule {
95 return az.pluralsRange
96 }
97
98
99 func (az *az) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
100
101 n := math.Abs(num)
102
103 if n == 1 {
104 return locales.PluralRuleOne
105 }
106
107 return locales.PluralRuleOther
108 }
109
110
111 func (az *az) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112
113 n := math.Abs(num)
114 i := int64(n)
115 iMod10 := i % 10
116 iMod100 := i % 100
117 iMod1000 := i % 1000
118
119 if (iMod10 == 1 || iMod10 == 2 || iMod10 == 5 || iMod10 == 7 || iMod10 == 8) || (iMod100 == 20 || iMod100 == 50 || iMod100 == 70 || iMod100 == 80) {
120 return locales.PluralRuleOne
121 } else if (iMod10 == 3 || iMod10 == 4) || (iMod1000 == 100 || iMod1000 == 200 || iMod1000 == 300 || iMod1000 == 400 || iMod1000 == 500 || iMod1000 == 600 || iMod1000 == 700 || iMod1000 == 800 || iMod1000 == 900) {
122 return locales.PluralRuleFew
123 } else if (i == 0) || (iMod10 == 6) || (iMod100 == 40 || iMod100 == 60 || iMod100 == 90) {
124 return locales.PluralRuleMany
125 }
126
127 return locales.PluralRuleOther
128 }
129
130
131 func (az *az) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
132
133 start := az.CardinalPluralRule(num1, v1)
134 end := az.CardinalPluralRule(num2, v2)
135
136 if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
137 return locales.PluralRuleOther
138 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
139 return locales.PluralRuleOne
140 }
141
142 return locales.PluralRuleOther
143
144 }
145
146
147 func (az *az) MonthAbbreviated(month time.Month) string {
148 return az.monthsAbbreviated[month]
149 }
150
151
152 func (az *az) MonthsAbbreviated() []string {
153 return az.monthsAbbreviated[1:]
154 }
155
156
157 func (az *az) MonthNarrow(month time.Month) string {
158 return az.monthsNarrow[month]
159 }
160
161
162 func (az *az) MonthsNarrow() []string {
163 return az.monthsNarrow[1:]
164 }
165
166
167 func (az *az) MonthWide(month time.Month) string {
168 return az.monthsWide[month]
169 }
170
171
172 func (az *az) MonthsWide() []string {
173 return az.monthsWide[1:]
174 }
175
176
177 func (az *az) WeekdayAbbreviated(weekday time.Weekday) string {
178 return az.daysAbbreviated[weekday]
179 }
180
181
182 func (az *az) WeekdaysAbbreviated() []string {
183 return az.daysAbbreviated
184 }
185
186
187 func (az *az) WeekdayNarrow(weekday time.Weekday) string {
188 return az.daysNarrow[weekday]
189 }
190
191
192 func (az *az) WeekdaysNarrow() []string {
193 return az.daysNarrow
194 }
195
196
197 func (az *az) WeekdayShort(weekday time.Weekday) string {
198 return az.daysShort[weekday]
199 }
200
201
202 func (az *az) WeekdaysShort() []string {
203 return az.daysShort
204 }
205
206
207 func (az *az) WeekdayWide(weekday time.Weekday) string {
208 return az.daysWide[weekday]
209 }
210
211
212 func (az *az) WeekdaysWide() []string {
213 return az.daysWide
214 }
215
216
217 func (az *az) Decimal() string {
218 return az.decimal
219 }
220
221
222 func (az *az) Group() string {
223 return az.group
224 }
225
226
227 func (az *az) Minus() string {
228 return az.minus
229 }
230
231
232 func (az *az) FmtNumber(num float64, v uint64) string {
233
234 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
235 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
236 count := 0
237 inWhole := v == 0
238 b := make([]byte, 0, l)
239
240 for i := len(s) - 1; i >= 0; i-- {
241
242 if s[i] == '.' {
243 b = append(b, az.decimal[0])
244 inWhole = true
245 continue
246 }
247
248 if inWhole {
249 if count == 3 {
250 b = append(b, az.group[0])
251 count = 1
252 } else {
253 count++
254 }
255 }
256
257 b = append(b, s[i])
258 }
259
260 if num < 0 {
261 b = append(b, az.minus[0])
262 }
263
264
265 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
266 b[i], b[j] = b[j], b[i]
267 }
268
269 return string(b)
270 }
271
272
273
274 func (az *az) FmtPercent(num float64, v uint64) string {
275 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
276 l := len(s) + 3
277 b := make([]byte, 0, l)
278
279 for i := len(s) - 1; i >= 0; i-- {
280
281 if s[i] == '.' {
282 b = append(b, az.decimal[0])
283 continue
284 }
285
286 b = append(b, s[i])
287 }
288
289 if num < 0 {
290 b = append(b, az.minus[0])
291 }
292
293
294 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
295 b[i], b[j] = b[j], b[i]
296 }
297
298 b = append(b, az.percent...)
299
300 return string(b)
301 }
302
303
304 func (az *az) FmtCurrency(num float64, v uint64, currency currency.Type) string {
305
306 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
307 symbol := az.currencies[currency]
308 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
309 count := 0
310 inWhole := v == 0
311 b := make([]byte, 0, l)
312
313 for i := len(s) - 1; i >= 0; i-- {
314
315 if s[i] == '.' {
316 b = append(b, az.decimal[0])
317 inWhole = true
318 continue
319 }
320
321 if inWhole {
322 if count == 3 {
323 b = append(b, az.group[0])
324 count = 1
325 } else {
326 count++
327 }
328 }
329
330 b = append(b, s[i])
331 }
332
333 if num < 0 {
334 b = append(b, az.minus[0])
335 }
336
337
338 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
339 b[i], b[j] = b[j], b[i]
340 }
341
342 if int(v) < 2 {
343
344 if v == 0 {
345 b = append(b, az.decimal...)
346 }
347
348 for i := 0; i < 2-int(v); i++ {
349 b = append(b, '0')
350 }
351 }
352
353 b = append(b, az.currencyPositiveSuffix...)
354
355 b = append(b, symbol...)
356
357 return string(b)
358 }
359
360
361
362 func (az *az) FmtAccounting(num float64, v uint64, currency currency.Type) string {
363
364 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
365 symbol := az.currencies[currency]
366 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
367 count := 0
368 inWhole := v == 0
369 b := make([]byte, 0, l)
370
371 for i := len(s) - 1; i >= 0; i-- {
372
373 if s[i] == '.' {
374 b = append(b, az.decimal[0])
375 inWhole = true
376 continue
377 }
378
379 if inWhole {
380 if count == 3 {
381 b = append(b, az.group[0])
382 count = 1
383 } else {
384 count++
385 }
386 }
387
388 b = append(b, s[i])
389 }
390
391 if num < 0 {
392
393 b = append(b, az.minus[0])
394
395 }
396
397
398 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
399 b[i], b[j] = b[j], b[i]
400 }
401
402 if int(v) < 2 {
403
404 if v == 0 {
405 b = append(b, az.decimal...)
406 }
407
408 for i := 0; i < 2-int(v); i++ {
409 b = append(b, '0')
410 }
411 }
412
413 if num < 0 {
414 b = append(b, az.currencyNegativeSuffix...)
415 b = append(b, symbol...)
416 } else {
417
418 b = append(b, az.currencyPositiveSuffix...)
419 b = append(b, symbol...)
420 }
421
422 return string(b)
423 }
424
425
426 func (az *az) FmtDateShort(t time.Time) string {
427
428 b := make([]byte, 0, 32)
429
430 if t.Day() < 10 {
431 b = append(b, '0')
432 }
433
434 b = strconv.AppendInt(b, int64(t.Day()), 10)
435 b = append(b, []byte{0x2e}...)
436
437 if t.Month() < 10 {
438 b = append(b, '0')
439 }
440
441 b = strconv.AppendInt(b, int64(t.Month()), 10)
442
443 b = append(b, []byte{0x2e}...)
444
445 if t.Year() > 9 {
446 b = append(b, strconv.Itoa(t.Year())[2:]...)
447 } else {
448 b = append(b, strconv.Itoa(t.Year())[1:]...)
449 }
450
451 return string(b)
452 }
453
454
455 func (az *az) FmtDateMedium(t time.Time) string {
456
457 b := make([]byte, 0, 32)
458
459 b = strconv.AppendInt(b, int64(t.Day()), 10)
460 b = append(b, []byte{0x20}...)
461 b = append(b, az.monthsAbbreviated[t.Month()]...)
462 b = append(b, []byte{0x20}...)
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 return string(b)
471 }
472
473
474 func (az *az) FmtDateLong(t time.Time) string {
475
476 b := make([]byte, 0, 32)
477
478 b = strconv.AppendInt(b, int64(t.Day()), 10)
479 b = append(b, []byte{0x20}...)
480 b = append(b, az.monthsWide[t.Month()]...)
481 b = append(b, []byte{0x20}...)
482
483 if t.Year() > 0 {
484 b = strconv.AppendInt(b, int64(t.Year()), 10)
485 } else {
486 b = strconv.AppendInt(b, int64(-t.Year()), 10)
487 }
488
489 return string(b)
490 }
491
492
493 func (az *az) FmtDateFull(t time.Time) string {
494
495 b := make([]byte, 0, 32)
496
497 b = strconv.AppendInt(b, int64(t.Day()), 10)
498 b = append(b, []byte{0x20}...)
499 b = append(b, az.monthsWide[t.Month()]...)
500 b = append(b, []byte{0x20}...)
501
502 if t.Year() > 0 {
503 b = strconv.AppendInt(b, int64(t.Year()), 10)
504 } else {
505 b = strconv.AppendInt(b, int64(-t.Year()), 10)
506 }
507
508 b = append(b, []byte{0x2c, 0x20}...)
509 b = append(b, az.daysWide[t.Weekday()]...)
510
511 return string(b)
512 }
513
514
515 func (az *az) FmtTimeShort(t time.Time) string {
516
517 b := make([]byte, 0, 32)
518
519 if t.Hour() < 10 {
520 b = append(b, '0')
521 }
522
523 b = strconv.AppendInt(b, int64(t.Hour()), 10)
524 b = append(b, az.timeSeparator...)
525
526 if t.Minute() < 10 {
527 b = append(b, '0')
528 }
529
530 b = strconv.AppendInt(b, int64(t.Minute()), 10)
531
532 return string(b)
533 }
534
535
536 func (az *az) FmtTimeMedium(t time.Time) string {
537
538 b := make([]byte, 0, 32)
539
540 if t.Hour() < 10 {
541 b = append(b, '0')
542 }
543
544 b = strconv.AppendInt(b, int64(t.Hour()), 10)
545 b = append(b, az.timeSeparator...)
546
547 if t.Minute() < 10 {
548 b = append(b, '0')
549 }
550
551 b = strconv.AppendInt(b, int64(t.Minute()), 10)
552 b = append(b, az.timeSeparator...)
553
554 if t.Second() < 10 {
555 b = append(b, '0')
556 }
557
558 b = strconv.AppendInt(b, int64(t.Second()), 10)
559
560 return string(b)
561 }
562
563
564 func (az *az) FmtTimeLong(t time.Time) string {
565
566 b := make([]byte, 0, 32)
567
568 if t.Hour() < 10 {
569 b = append(b, '0')
570 }
571
572 b = strconv.AppendInt(b, int64(t.Hour()), 10)
573 b = append(b, az.timeSeparator...)
574
575 if t.Minute() < 10 {
576 b = append(b, '0')
577 }
578
579 b = strconv.AppendInt(b, int64(t.Minute()), 10)
580 b = append(b, az.timeSeparator...)
581
582 if t.Second() < 10 {
583 b = append(b, '0')
584 }
585
586 b = strconv.AppendInt(b, int64(t.Second()), 10)
587 b = append(b, []byte{0x20}...)
588
589 tz, _ := t.Zone()
590 b = append(b, tz...)
591
592 return string(b)
593 }
594
595
596 func (az *az) FmtTimeFull(t time.Time) string {
597
598 b := make([]byte, 0, 32)
599
600 if t.Hour() < 10 {
601 b = append(b, '0')
602 }
603
604 b = strconv.AppendInt(b, int64(t.Hour()), 10)
605 b = append(b, az.timeSeparator...)
606
607 if t.Minute() < 10 {
608 b = append(b, '0')
609 }
610
611 b = strconv.AppendInt(b, int64(t.Minute()), 10)
612 b = append(b, az.timeSeparator...)
613
614 if t.Second() < 10 {
615 b = append(b, '0')
616 }
617
618 b = strconv.AppendInt(b, int64(t.Second()), 10)
619 b = append(b, []byte{0x20}...)
620
621 tz, _ := t.Zone()
622
623 if btz, ok := az.timezones[tz]; ok {
624 b = append(b, btz...)
625 } else {
626 b = append(b, tz...)
627 }
628
629 return string(b)
630 }
631
View as plain text