1 package sq_AL
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 sq_AL 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 currencyNegativePrefix string
27 currencyNegativeSuffix string
28 monthsAbbreviated []string
29 monthsNarrow []string
30 monthsWide []string
31 daysAbbreviated []string
32 daysNarrow []string
33 daysShort []string
34 daysWide []string
35 periodsAbbreviated []string
36 periodsNarrow []string
37 periodsShort []string
38 periodsWide []string
39 erasAbbreviated []string
40 erasNarrow []string
41 erasWide []string
42 timezones map[string]string
43 }
44
45
46 func New() locales.Translator {
47 return &sq_AL{
48 locale: "sq_AL",
49 pluralsCardinal: []locales.PluralRule{2, 6},
50 pluralsOrdinal: []locales.PluralRule{2, 5, 6},
51 pluralsRange: []locales.PluralRule{2, 6},
52 decimal: ",",
53 group: " ",
54 minus: "-",
55 percent: "%",
56 perMille: "‰",
57 timeSeparator: ":",
58 inifinity: "∞",
59 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", "XAF", "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"},
60 currencyPositiveSuffix: " ",
61 currencyNegativePrefix: "(",
62 currencyNegativeSuffix: " )",
63 monthsAbbreviated: []string{"", "jan", "shk", "mar", "pri", "maj", "qer", "korr", "gush", "sht", "tet", "nën", "dhj"},
64 monthsNarrow: []string{"", "j", "sh", "m", "p", "m", "q", "k", "g", "sh", "t", "n", "dh"},
65 monthsWide: []string{"", "janar", "shkurt", "mars", "prill", "maj", "qershor", "korrik", "gusht", "shtator", "tetor", "nëntor", "dhjetor"},
66 daysAbbreviated: []string{"Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Sht"},
67 daysNarrow: []string{"d", "h", "m", "m", "e", "p", "sh"},
68 daysShort: []string{"die", "hën", "mar", "mër", "enj", "pre", "sht"},
69 daysWide: []string{"e diel", "e hënë", "e martë", "e mërkurë", "e enjte", "e premte", "e shtunë"},
70 periodsAbbreviated: []string{"p.d.", "m.d."},
71 periodsNarrow: []string{"p.d.", "m.d."},
72 periodsWide: []string{"e paradites", "e pasdites"},
73 erasAbbreviated: []string{"p.K.", "mb.K."},
74 erasNarrow: []string{"p.K.", "mb.K."},
75 erasWide: []string{"para Krishtit", "mbas Krishtit"},
76 timezones: map[string]string{"ACDT": "Ora verore e Australisë Qendrore", "ACST": "Ora standarde e Australisë Qendrore", "ACWDT": "Ora verore e Australisë Qendroro-Perëndimore", "ACWST": "Ora standarde e Australisë Qendroro-Perëndimore", "ADT": "Ora verore e Atlantikut", "AEDT": "Ora verore e Australisë Lindore", "AEST": "Ora standarde e Australisë Lindore", "AKDT": "Ora verore e Alaskës", "AKST": "Ora standarde e Alaskës", "ARST": "Ora verore e Argjentinës", "ART": "Ora standarde e Argjentinës", "AST": "Ora standarde e Atlantikut", "AWDT": "Ora verore e Australisë Perëndimore", "AWST": "Ora standarde e Australisë Perëndimore", "BOT": "Ora e Bolivisë", "BT": "Ora e Butanit", "CAT": "Ora e Afrikës Qendrore", "CDT": "Ora verore e SHBA-së Qendrore", "CHADT": "Ora verore e Katamit", "CHAST": "Ora standarde e Katamit", "CLST": "Ora verore e Kilit", "CLT": "Ora standarde e Kilit", "COST": "Ora verore e Kolumbisë", "COT": "Ora standarde e Kolumbisë", "CST": "Ora standarde e SHBA-së Qendrore", "ChST": "Ora e Kamorros", "EAT": "Ora e Afrikës Lindore", "ECT": "Ora e Ekuadorit", "EDT": "Ora verore e SHBA-së Lindore", "EST": "Ora standarde e SHBA-së Lindore", "GFT": "Ora e Guajanës Franceze", "GMT": "Ora e Grinuiçit", "GST": "Ora e Gjirit", "GYT": "Ora e Guajanës", "HADT": "Ora verore e Ishujve Hauai-Aleutian", "HAST": "Ora standarde e Ishujve Hauai-Aleutian", "HAT": "Ora verore e Njufaundlendit [Tokës së Re]", "HECU": "Ora verore e Kubës", "HEEG": "Ora verore e Grenlandës Lindore", "HENOMX": "Ora verore e Meksikës Veriperëndimore", "HEOG": "Ora verore e Grënlandës Perëndimore", "HEPM": "Ora verore e Shën-Pier dhe Mikelon", "HEPMX": "Ora verore e Territoreve Meksikane të Bregut të Paqësorit", "HKST": "Ora verore e Hong-Kongut", "HKT": "Ora standarde e Hong-Kongut", "HNCU": "Ora standarde e Kubës", "HNEG": "Ora standarde e Grenlandës Lindore", "HNNOMX": "Ora standarde e Meksikës Veriperëndimore", "HNOG": "Ora standarde e Grënlandës Perëndimore", "HNPM": "Ora standarde e Shën-Pier dhe Mikelon", "HNPMX": "Ora standarde e Territoreve Meksikane të Bregut të Paqësorit", "HNT": "Ora standarde e Njufaundlendit [Tokës së Re]", "IST": "Ora standarde e Indisë", "JDT": "Ora verore e Japonisë", "JST": "Ora standarde e Japonisë", "LHDT": "Ora verore e Lord-Houit", "LHST": "Ora standarde e Lord-Houit", "MDT": "Ora verore e Territoreve Amerikane të Brezit Malor", "MESZ": "Ora verore e Evropës Qendrore", "MEZ": "Ora standarde e Evropës Qendrore", "MST": "Ora standarde e Territoreve Amerikane të Brezit Malor", "MYT": "Ora e Malajzisë", "NZDT": "Ora verore e Zelandës së Re", "NZST": "Ora standarde e Zelandës së Re", "OESZ": "Ora verore e Evropës Lindore", "OEZ": "Ora standarde e Evropës Lindore", "PDT": "Ora verore e Territoreve Amerikane të Bregut të Paqësorit", "PST": "Ora standarde e Territoreve Amerikane të Bregut të Paqësorit", "SAST": "Ora standarde e Afrikës Jugore", "SGT": "Ora e Singaporit", "SRT": "Ora e Surinamit", "TMST": "Ora verore e Turkmenistanit", "TMT": "Ora standarde e Turkmenistanit", "UYST": "Ora verore e Uruguait", "UYT": "Ora standarde e Uruguait", "VET": "Ora e Venezuelës", "WARST": "Ora verore e Argjentinës Perëndimore", "WART": "Ora standarde e Argjentinës Perëndimore", "WAST": "Ora verore e Afrikës Perëndimore", "WAT": "Ora standarde e Afrikës Perëndimore", "WESZ": "Ora verore e Evropës Perëndimore", "WEZ": "Ora standarde e Evropës Perëndimore", "WIB": "Ora e Indonezisë Perëndimore", "WIT": "Ora e Indonezisë Lindore", "WITA": "Ora e Indonezisë Qendrore", "∅∅∅": "Ora verore e Brazilisë"},
77 }
78 }
79
80
81 func (sq *sq_AL) Locale() string {
82 return sq.locale
83 }
84
85
86 func (sq *sq_AL) PluralsCardinal() []locales.PluralRule {
87 return sq.pluralsCardinal
88 }
89
90
91 func (sq *sq_AL) PluralsOrdinal() []locales.PluralRule {
92 return sq.pluralsOrdinal
93 }
94
95
96 func (sq *sq_AL) PluralsRange() []locales.PluralRule {
97 return sq.pluralsRange
98 }
99
100
101 func (sq *sq_AL) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
102
103 n := math.Abs(num)
104
105 if n == 1 {
106 return locales.PluralRuleOne
107 }
108
109 return locales.PluralRuleOther
110 }
111
112
113 func (sq *sq_AL) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
114
115 n := math.Abs(num)
116 nMod10 := math.Mod(n, 10)
117 nMod100 := math.Mod(n, 100)
118
119 if n == 1 {
120 return locales.PluralRuleOne
121 } else if nMod10 == 4 && nMod100 != 14 {
122 return locales.PluralRuleMany
123 }
124
125 return locales.PluralRuleOther
126 }
127
128
129 func (sq *sq_AL) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
130
131 start := sq.CardinalPluralRule(num1, v1)
132 end := sq.CardinalPluralRule(num2, v2)
133
134 if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
135 return locales.PluralRuleOther
136 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
137 return locales.PluralRuleOne
138 }
139
140 return locales.PluralRuleOther
141
142 }
143
144
145 func (sq *sq_AL) MonthAbbreviated(month time.Month) string {
146 return sq.monthsAbbreviated[month]
147 }
148
149
150 func (sq *sq_AL) MonthsAbbreviated() []string {
151 return sq.monthsAbbreviated[1:]
152 }
153
154
155 func (sq *sq_AL) MonthNarrow(month time.Month) string {
156 return sq.monthsNarrow[month]
157 }
158
159
160 func (sq *sq_AL) MonthsNarrow() []string {
161 return sq.monthsNarrow[1:]
162 }
163
164
165 func (sq *sq_AL) MonthWide(month time.Month) string {
166 return sq.monthsWide[month]
167 }
168
169
170 func (sq *sq_AL) MonthsWide() []string {
171 return sq.monthsWide[1:]
172 }
173
174
175 func (sq *sq_AL) WeekdayAbbreviated(weekday time.Weekday) string {
176 return sq.daysAbbreviated[weekday]
177 }
178
179
180 func (sq *sq_AL) WeekdaysAbbreviated() []string {
181 return sq.daysAbbreviated
182 }
183
184
185 func (sq *sq_AL) WeekdayNarrow(weekday time.Weekday) string {
186 return sq.daysNarrow[weekday]
187 }
188
189
190 func (sq *sq_AL) WeekdaysNarrow() []string {
191 return sq.daysNarrow
192 }
193
194
195 func (sq *sq_AL) WeekdayShort(weekday time.Weekday) string {
196 return sq.daysShort[weekday]
197 }
198
199
200 func (sq *sq_AL) WeekdaysShort() []string {
201 return sq.daysShort
202 }
203
204
205 func (sq *sq_AL) WeekdayWide(weekday time.Weekday) string {
206 return sq.daysWide[weekday]
207 }
208
209
210 func (sq *sq_AL) WeekdaysWide() []string {
211 return sq.daysWide
212 }
213
214
215 func (sq *sq_AL) Decimal() string {
216 return sq.decimal
217 }
218
219
220 func (sq *sq_AL) Group() string {
221 return sq.group
222 }
223
224
225 func (sq *sq_AL) Minus() string {
226 return sq.minus
227 }
228
229
230 func (sq *sq_AL) FmtNumber(num float64, v uint64) string {
231
232 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
233 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
234 count := 0
235 inWhole := v == 0
236 b := make([]byte, 0, l)
237
238 for i := len(s) - 1; i >= 0; i-- {
239
240 if s[i] == '.' {
241 b = append(b, sq.decimal[0])
242 inWhole = true
243 continue
244 }
245
246 if inWhole {
247 if count == 3 {
248 for j := len(sq.group) - 1; j >= 0; j-- {
249 b = append(b, sq.group[j])
250 }
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, sq.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 (sq *sq_AL) 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, sq.decimal[0])
283 continue
284 }
285
286 b = append(b, s[i])
287 }
288
289 if num < 0 {
290 b = append(b, sq.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, sq.percent...)
299
300 return string(b)
301 }
302
303
304 func (sq *sq_AL) FmtCurrency(num float64, v uint64, currency currency.Type) string {
305
306 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
307 symbol := sq.currencies[currency]
308 l := len(s) + len(symbol) + 4 + 2*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, sq.decimal[0])
317 inWhole = true
318 continue
319 }
320
321 if inWhole {
322 if count == 3 {
323 for j := len(sq.group) - 1; j >= 0; j-- {
324 b = append(b, sq.group[j])
325 }
326 count = 1
327 } else {
328 count++
329 }
330 }
331
332 b = append(b, s[i])
333 }
334
335 if num < 0 {
336 b = append(b, sq.minus[0])
337 }
338
339
340 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
341 b[i], b[j] = b[j], b[i]
342 }
343
344 if int(v) < 2 {
345
346 if v == 0 {
347 b = append(b, sq.decimal...)
348 }
349
350 for i := 0; i < 2-int(v); i++ {
351 b = append(b, '0')
352 }
353 }
354
355 b = append(b, sq.currencyPositiveSuffix...)
356
357 b = append(b, symbol...)
358
359 return string(b)
360 }
361
362
363
364 func (sq *sq_AL) FmtAccounting(num float64, v uint64, currency currency.Type) string {
365
366 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
367 symbol := sq.currencies[currency]
368 l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
369 count := 0
370 inWhole := v == 0
371 b := make([]byte, 0, l)
372
373 for i := len(s) - 1; i >= 0; i-- {
374
375 if s[i] == '.' {
376 b = append(b, sq.decimal[0])
377 inWhole = true
378 continue
379 }
380
381 if inWhole {
382 if count == 3 {
383 for j := len(sq.group) - 1; j >= 0; j-- {
384 b = append(b, sq.group[j])
385 }
386 count = 1
387 } else {
388 count++
389 }
390 }
391
392 b = append(b, s[i])
393 }
394
395 if num < 0 {
396
397 b = append(b, sq.currencyNegativePrefix[0])
398
399 }
400
401
402 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
403 b[i], b[j] = b[j], b[i]
404 }
405
406 if int(v) < 2 {
407
408 if v == 0 {
409 b = append(b, sq.decimal...)
410 }
411
412 for i := 0; i < 2-int(v); i++ {
413 b = append(b, '0')
414 }
415 }
416
417 if num < 0 {
418 b = append(b, sq.currencyNegativeSuffix...)
419 b = append(b, symbol...)
420 } else {
421
422 b = append(b, sq.currencyPositiveSuffix...)
423 b = append(b, symbol...)
424 }
425
426 return string(b)
427 }
428
429
430 func (sq *sq_AL) FmtDateShort(t time.Time) string {
431
432 b := make([]byte, 0, 32)
433
434 b = strconv.AppendInt(b, int64(t.Day()), 10)
435 b = append(b, []byte{0x2e}...)
436 b = strconv.AppendInt(b, int64(t.Month()), 10)
437 b = append(b, []byte{0x2e}...)
438
439 if t.Year() > 9 {
440 b = append(b, strconv.Itoa(t.Year())[2:]...)
441 } else {
442 b = append(b, strconv.Itoa(t.Year())[1:]...)
443 }
444
445 return string(b)
446 }
447
448
449 func (sq *sq_AL) FmtDateMedium(t time.Time) string {
450
451 b := make([]byte, 0, 32)
452
453 b = strconv.AppendInt(b, int64(t.Day()), 10)
454 b = append(b, []byte{0x20}...)
455 b = append(b, sq.monthsAbbreviated[t.Month()]...)
456 b = append(b, []byte{0x20}...)
457
458 if t.Year() > 0 {
459 b = strconv.AppendInt(b, int64(t.Year()), 10)
460 } else {
461 b = strconv.AppendInt(b, int64(-t.Year()), 10)
462 }
463
464 return string(b)
465 }
466
467
468 func (sq *sq_AL) FmtDateLong(t time.Time) string {
469
470 b := make([]byte, 0, 32)
471
472 b = strconv.AppendInt(b, int64(t.Day()), 10)
473 b = append(b, []byte{0x20}...)
474 b = append(b, sq.monthsWide[t.Month()]...)
475 b = append(b, []byte{0x20}...)
476
477 if t.Year() > 0 {
478 b = strconv.AppendInt(b, int64(t.Year()), 10)
479 } else {
480 b = strconv.AppendInt(b, int64(-t.Year()), 10)
481 }
482
483 return string(b)
484 }
485
486
487 func (sq *sq_AL) FmtDateFull(t time.Time) string {
488
489 b := make([]byte, 0, 32)
490
491 b = append(b, sq.daysWide[t.Weekday()]...)
492 b = append(b, []byte{0x2c, 0x20}...)
493 b = strconv.AppendInt(b, int64(t.Day()), 10)
494 b = append(b, []byte{0x20}...)
495 b = append(b, sq.monthsWide[t.Month()]...)
496 b = append(b, []byte{0x20}...)
497
498 if t.Year() > 0 {
499 b = strconv.AppendInt(b, int64(t.Year()), 10)
500 } else {
501 b = strconv.AppendInt(b, int64(-t.Year()), 10)
502 }
503
504 return string(b)
505 }
506
507
508 func (sq *sq_AL) FmtTimeShort(t time.Time) string {
509
510 b := make([]byte, 0, 32)
511
512 h := t.Hour()
513
514 if h > 12 {
515 h -= 12
516 }
517
518 b = strconv.AppendInt(b, int64(h), 10)
519 b = append(b, sq.timeSeparator...)
520
521 if t.Minute() < 10 {
522 b = append(b, '0')
523 }
524
525 b = strconv.AppendInt(b, int64(t.Minute()), 10)
526 b = append(b, []byte{0x20}...)
527
528 if t.Hour() < 12 {
529 b = append(b, sq.periodsAbbreviated[0]...)
530 } else {
531 b = append(b, sq.periodsAbbreviated[1]...)
532 }
533
534 return string(b)
535 }
536
537
538 func (sq *sq_AL) FmtTimeMedium(t time.Time) string {
539
540 b := make([]byte, 0, 32)
541
542 h := t.Hour()
543
544 if h > 12 {
545 h -= 12
546 }
547
548 b = strconv.AppendInt(b, int64(h), 10)
549 b = append(b, sq.timeSeparator...)
550
551 if t.Minute() < 10 {
552 b = append(b, '0')
553 }
554
555 b = strconv.AppendInt(b, int64(t.Minute()), 10)
556 b = append(b, sq.timeSeparator...)
557
558 if t.Second() < 10 {
559 b = append(b, '0')
560 }
561
562 b = strconv.AppendInt(b, int64(t.Second()), 10)
563 b = append(b, []byte{0x20}...)
564
565 if t.Hour() < 12 {
566 b = append(b, sq.periodsAbbreviated[0]...)
567 } else {
568 b = append(b, sq.periodsAbbreviated[1]...)
569 }
570
571 return string(b)
572 }
573
574
575 func (sq *sq_AL) FmtTimeLong(t time.Time) string {
576
577 b := make([]byte, 0, 32)
578
579 h := t.Hour()
580
581 if h > 12 {
582 h -= 12
583 }
584
585 b = strconv.AppendInt(b, int64(h), 10)
586 b = append(b, sq.timeSeparator...)
587
588 if t.Minute() < 10 {
589 b = append(b, '0')
590 }
591
592 b = strconv.AppendInt(b, int64(t.Minute()), 10)
593 b = append(b, sq.timeSeparator...)
594
595 if t.Second() < 10 {
596 b = append(b, '0')
597 }
598
599 b = strconv.AppendInt(b, int64(t.Second()), 10)
600 b = append(b, []byte{0x20}...)
601
602 if t.Hour() < 12 {
603 b = append(b, sq.periodsAbbreviated[0]...)
604 } else {
605 b = append(b, sq.periodsAbbreviated[1]...)
606 }
607
608 b = append(b, []byte{0x2c, 0x20}...)
609
610 tz, _ := t.Zone()
611 b = append(b, tz...)
612
613 return string(b)
614 }
615
616
617 func (sq *sq_AL) FmtTimeFull(t time.Time) string {
618
619 b := make([]byte, 0, 32)
620
621 h := t.Hour()
622
623 if h > 12 {
624 h -= 12
625 }
626
627 b = strconv.AppendInt(b, int64(h), 10)
628 b = append(b, sq.timeSeparator...)
629
630 if t.Minute() < 10 {
631 b = append(b, '0')
632 }
633
634 b = strconv.AppendInt(b, int64(t.Minute()), 10)
635 b = append(b, sq.timeSeparator...)
636
637 if t.Second() < 10 {
638 b = append(b, '0')
639 }
640
641 b = strconv.AppendInt(b, int64(t.Second()), 10)
642 b = append(b, []byte{0x20}...)
643
644 if t.Hour() < 12 {
645 b = append(b, sq.periodsAbbreviated[0]...)
646 } else {
647 b = append(b, sq.periodsAbbreviated[1]...)
648 }
649
650 b = append(b, []byte{0x2c, 0x20}...)
651
652 tz, _ := t.Zone()
653
654 if btz, ok := sq.timezones[tz]; ok {
655 b = append(b, btz...)
656 } else {
657 b = append(b, tz...)
658 }
659
660 return string(b)
661 }
662
View as plain text