1 package cy_GB
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 cy_GB 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 currencyNegativePrefix 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 &cy_GB{
47 locale: "cy_GB",
48 pluralsCardinal: []locales.PluralRule{1, 2, 3, 4, 5, 6},
49 pluralsOrdinal: []locales.PluralRule{1, 2, 3, 4, 5, 6},
50 pluralsRange: []locales.PluralRule{2, 3, 4, 5, 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", "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"},
59 currencyNegativePrefix: "(",
60 currencyNegativeSuffix: ")",
61 monthsAbbreviated: []string{"", "Ion", "Chwef", "Maw", "Ebr", "Mai", "Meh", "Gorff", "Awst", "Medi", "Hyd", "Tach", "Rhag"},
62 monthsNarrow: []string{"", "I", "Ch", "M", "E", "M", "M", "G", "A", "M", "H", "T", "Rh"},
63 monthsWide: []string{"", "Ionawr", "Chwefror", "Mawrth", "Ebrill", "Mai", "Mehefin", "Gorffennaf", "Awst", "Medi", "Hydref", "Tachwedd", "Rhagfyr"},
64 daysAbbreviated: []string{"Sul", "Llun", "Maw", "Mer", "Iau", "Gwen", "Sad"},
65 daysNarrow: []string{"S", "Ll", "M", "M", "I", "G", "S"},
66 daysShort: []string{"Su", "Ll", "Ma", "Me", "Ia", "Gw", "Sa"},
67 daysWide: []string{"Dydd Sul", "Dydd Llun", "Dydd Mawrth", "Dydd Mercher", "Dydd Iau", "Dydd Gwener", "Dydd Sadwrn"},
68 periodsAbbreviated: []string{"", ""},
69 periodsNarrow: []string{"b", "h"},
70 periodsWide: []string{"yb", "yh"},
71 erasAbbreviated: []string{"CC", "OC"},
72 erasNarrow: []string{"C", "O"},
73 erasWide: []string{"Cyn Crist", "Oed Crist"},
74 timezones: map[string]string{"ACDT": "Amser Haf Canolbarth Awstralia", "ACST": "Amser Safonol Canolbarth Awstralia", "ACWDT": "Amser Haf Canolbarth Gorllewin Awstralia", "ACWST": "Amser Safonol Canolbarth Gorllewin Awstralia", "ADT": "Amser Haf Cefnfor yr Iwerydd", "AEDT": "Amser Haf Dwyrain Awstralia", "AEST": "Amser Safonol Dwyrain Awstralia", "AKDT": "Amser Haf Alaska", "AKST": "Amser Safonol Alaska", "ARST": "Amser Haf Ariannin", "ART": "Amser Safonol Ariannin", "AST": "Amser Safonol Cefnfor yr Iwerydd", "AWDT": "Amser Haf Gorllewin Awstralia", "AWST": "Amser Safonol Gorllewin Awstralia", "BOT": "Amser Bolivia", "BT": "Amser Bhutan", "CAT": "Amser Canolbarth Affrica", "CDT": "Amser Haf Canolbarth Gogledd America", "CHADT": "Amser Haf Chatham", "CHAST": "Amser Safonol Chatham", "CLST": "Amser Haf Chile", "CLT": "Amser Safonol Chile", "COST": "Amser Haf Colombia", "COT": "Amser Safonol Colombia", "CST": "Amser Safonol Canolbarth Gogledd America", "ChST": "Amser Chamorro", "EAT": "Amser Dwyrain Affrica", "ECT": "Amser Ecuador", "EDT": "Amser Haf Dwyrain Gogledd America", "EST": "Amser Safonol Dwyrain Gogledd America", "GFT": "Amser Guyane Ffrengig", "GMT": "Amser Safonol Greenwich", "GST": "Amser Safonol y Gwlff", "GYT": "Amser Guyana", "HADT": "Amser Haf Hawaii-Aleutian", "HAST": "Amser Safonol Hawaii-Aleutian", "HAT": "Amser Haf Newfoundland", "HECU": "Amser Haf Cuba", "HEEG": "Amser Haf Dwyrain yr Ynys Las", "HENOMX": "Amser Haf Gogledd Orllewin Mecsico", "HEOG": "Amser Haf Gorllewin yr Ynys Las", "HEPM": "Amser Haf Saint-Pierre-et-Miquelon", "HEPMX": "Amser Haf Pasiffig Mecsico", "HKST": "Amser Haf Hong Kong", "HKT": "Amser Safonol Hong Kong", "HNCU": "Amser Safonol Cuba", "HNEG": "Amser Safonol Dwyrain yr Ynys Las", "HNNOMX": "Amser Safonol Gogledd Orllewin Mecsico", "HNOG": "Amser Safonol Gorllewin yr Ynys Las", "HNPM": "Amser Safonol Saint-Pierre-et-Miquelon", "HNPMX": "Amser Safonol Pasiffig Mecsico", "HNT": "Amser Safonol Newfoundland", "IST": "Amser India", "JDT": "Amser Haf Siapan", "JST": "Amser Safonol Siapan", "LHDT": "Amser Haf yr Arglwydd Howe", "LHST": "Amser Safonol yr Arglwydd Howe", "MDT": "Amser Haf Mynyddoedd Gogledd America", "MESZ": "Amser Haf Canolbarth Ewrop", "MEZ": "Amser Safonol Canolbarth Ewrop", "MST": "Amser Safonol Mynyddoedd Gogledd America", "MYT": "Amser Malaysia", "NZDT": "Amser Haf Seland Newydd", "NZST": "Amser Safonol Seland Newydd", "OESZ": "Amser Haf Dwyrain Ewrop", "OEZ": "Amser Safonol Dwyrain Ewrop", "PDT": "Amser Haf Cefnfor Tawel Gogledd America", "PST": "Amser Safonol Cefnfor Tawel Gogledd America", "SAST": "Amser Safonol De Affrica", "SGT": "Amser Singapore", "SRT": "Amser Suriname", "TMST": "Amser Haf Tyrcmenistan", "TMT": "Amser Safonol Tyrcmenistan", "UYST": "Amser Haf Uruguay", "UYT": "Amser Safonol Uruguay", "VET": "Amser Venezuela", "WARST": "Amser Haf Gorllewin Ariannin", "WART": "Amser Safonol Gorllewin Ariannin", "WAST": "Amser Haf Gorllewin Affrica", "WAT": "Amser Safonol Gorllewin Affrica", "WESZ": "Amser Haf Gorllewin Ewrop", "WEZ": "Amser Safonol Gorllewin Ewrop", "WIB": "Amser Gorllewin Indonesia", "WIT": "Amser Dwyrain Indonesia", "WITA": "Amser Canolbarth Indonesia", "∅∅∅": "Amser Haf Brasília"},
75 }
76 }
77
78
79 func (cy *cy_GB) Locale() string {
80 return cy.locale
81 }
82
83
84 func (cy *cy_GB) PluralsCardinal() []locales.PluralRule {
85 return cy.pluralsCardinal
86 }
87
88
89 func (cy *cy_GB) PluralsOrdinal() []locales.PluralRule {
90 return cy.pluralsOrdinal
91 }
92
93
94 func (cy *cy_GB) PluralsRange() []locales.PluralRule {
95 return cy.pluralsRange
96 }
97
98
99 func (cy *cy_GB) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
100
101 n := math.Abs(num)
102
103 if n == 0 {
104 return locales.PluralRuleZero
105 } else if n == 1 {
106 return locales.PluralRuleOne
107 } else if n == 2 {
108 return locales.PluralRuleTwo
109 } else if n == 3 {
110 return locales.PluralRuleFew
111 } else if n == 6 {
112 return locales.PluralRuleMany
113 }
114
115 return locales.PluralRuleOther
116 }
117
118
119 func (cy *cy_GB) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
120
121 n := math.Abs(num)
122
123 if n == 0 || n == 7 || n == 8 || n == 9 {
124 return locales.PluralRuleZero
125 } else if n == 1 {
126 return locales.PluralRuleOne
127 } else if n == 2 {
128 return locales.PluralRuleTwo
129 } else if n == 3 || n == 4 {
130 return locales.PluralRuleFew
131 } else if n == 5 || n == 6 {
132 return locales.PluralRuleMany
133 }
134
135 return locales.PluralRuleOther
136 }
137
138
139 func (cy *cy_GB) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
140
141 start := cy.CardinalPluralRule(num1, v1)
142 end := cy.CardinalPluralRule(num2, v2)
143
144 if start == locales.PluralRuleZero && end == locales.PluralRuleOne {
145 return locales.PluralRuleOne
146 } else if start == locales.PluralRuleZero && end == locales.PluralRuleTwo {
147 return locales.PluralRuleTwo
148 } else if start == locales.PluralRuleZero && end == locales.PluralRuleFew {
149 return locales.PluralRuleFew
150 } else if start == locales.PluralRuleZero && end == locales.PluralRuleMany {
151 return locales.PluralRuleMany
152 } else if start == locales.PluralRuleZero && end == locales.PluralRuleOther {
153 return locales.PluralRuleOther
154 } else if start == locales.PluralRuleOne && end == locales.PluralRuleTwo {
155 return locales.PluralRuleTwo
156 } else if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
157 return locales.PluralRuleFew
158 } else if start == locales.PluralRuleOne && end == locales.PluralRuleMany {
159 return locales.PluralRuleMany
160 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
161 return locales.PluralRuleOther
162 } else if start == locales.PluralRuleTwo && end == locales.PluralRuleFew {
163 return locales.PluralRuleFew
164 } else if start == locales.PluralRuleTwo && end == locales.PluralRuleMany {
165 return locales.PluralRuleMany
166 } else if start == locales.PluralRuleTwo && end == locales.PluralRuleOther {
167 return locales.PluralRuleOther
168 } else if start == locales.PluralRuleFew && end == locales.PluralRuleMany {
169 return locales.PluralRuleMany
170 } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
171 return locales.PluralRuleOther
172 } else if start == locales.PluralRuleMany && end == locales.PluralRuleOther {
173 return locales.PluralRuleOther
174 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
175 return locales.PluralRuleOne
176 } else if start == locales.PluralRuleOther && end == locales.PluralRuleTwo {
177 return locales.PluralRuleTwo
178 } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
179 return locales.PluralRuleFew
180 } else if start == locales.PluralRuleOther && end == locales.PluralRuleMany {
181 return locales.PluralRuleMany
182 }
183
184 return locales.PluralRuleOther
185
186 }
187
188
189 func (cy *cy_GB) MonthAbbreviated(month time.Month) string {
190 return cy.monthsAbbreviated[month]
191 }
192
193
194 func (cy *cy_GB) MonthsAbbreviated() []string {
195 return cy.monthsAbbreviated[1:]
196 }
197
198
199 func (cy *cy_GB) MonthNarrow(month time.Month) string {
200 return cy.monthsNarrow[month]
201 }
202
203
204 func (cy *cy_GB) MonthsNarrow() []string {
205 return cy.monthsNarrow[1:]
206 }
207
208
209 func (cy *cy_GB) MonthWide(month time.Month) string {
210 return cy.monthsWide[month]
211 }
212
213
214 func (cy *cy_GB) MonthsWide() []string {
215 return cy.monthsWide[1:]
216 }
217
218
219 func (cy *cy_GB) WeekdayAbbreviated(weekday time.Weekday) string {
220 return cy.daysAbbreviated[weekday]
221 }
222
223
224 func (cy *cy_GB) WeekdaysAbbreviated() []string {
225 return cy.daysAbbreviated
226 }
227
228
229 func (cy *cy_GB) WeekdayNarrow(weekday time.Weekday) string {
230 return cy.daysNarrow[weekday]
231 }
232
233
234 func (cy *cy_GB) WeekdaysNarrow() []string {
235 return cy.daysNarrow
236 }
237
238
239 func (cy *cy_GB) WeekdayShort(weekday time.Weekday) string {
240 return cy.daysShort[weekday]
241 }
242
243
244 func (cy *cy_GB) WeekdaysShort() []string {
245 return cy.daysShort
246 }
247
248
249 func (cy *cy_GB) WeekdayWide(weekday time.Weekday) string {
250 return cy.daysWide[weekday]
251 }
252
253
254 func (cy *cy_GB) WeekdaysWide() []string {
255 return cy.daysWide
256 }
257
258
259 func (cy *cy_GB) Decimal() string {
260 return cy.decimal
261 }
262
263
264 func (cy *cy_GB) Group() string {
265 return cy.group
266 }
267
268
269 func (cy *cy_GB) Minus() string {
270 return cy.minus
271 }
272
273
274 func (cy *cy_GB) FmtNumber(num float64, v uint64) string {
275
276 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
277 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
278 count := 0
279 inWhole := v == 0
280 b := make([]byte, 0, l)
281
282 for i := len(s) - 1; i >= 0; i-- {
283
284 if s[i] == '.' {
285 b = append(b, cy.decimal[0])
286 inWhole = true
287 continue
288 }
289
290 if inWhole {
291 if count == 3 {
292 b = append(b, cy.group[0])
293 count = 1
294 } else {
295 count++
296 }
297 }
298
299 b = append(b, s[i])
300 }
301
302 if num < 0 {
303 b = append(b, cy.minus[0])
304 }
305
306
307 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
308 b[i], b[j] = b[j], b[i]
309 }
310
311 return string(b)
312 }
313
314
315
316 func (cy *cy_GB) FmtPercent(num float64, v uint64) string {
317 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
318 l := len(s) + 3
319 b := make([]byte, 0, l)
320
321 for i := len(s) - 1; i >= 0; i-- {
322
323 if s[i] == '.' {
324 b = append(b, cy.decimal[0])
325 continue
326 }
327
328 b = append(b, s[i])
329 }
330
331 if num < 0 {
332 b = append(b, cy.minus[0])
333 }
334
335
336 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
337 b[i], b[j] = b[j], b[i]
338 }
339
340 b = append(b, cy.percent...)
341
342 return string(b)
343 }
344
345
346 func (cy *cy_GB) FmtCurrency(num float64, v uint64, currency currency.Type) string {
347
348 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
349 symbol := cy.currencies[currency]
350 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
351 count := 0
352 inWhole := v == 0
353 b := make([]byte, 0, l)
354
355 for i := len(s) - 1; i >= 0; i-- {
356
357 if s[i] == '.' {
358 b = append(b, cy.decimal[0])
359 inWhole = true
360 continue
361 }
362
363 if inWhole {
364 if count == 3 {
365 b = append(b, cy.group[0])
366 count = 1
367 } else {
368 count++
369 }
370 }
371
372 b = append(b, s[i])
373 }
374
375 for j := len(symbol) - 1; j >= 0; j-- {
376 b = append(b, symbol[j])
377 }
378
379 if num < 0 {
380 b = append(b, cy.minus[0])
381 }
382
383
384 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
385 b[i], b[j] = b[j], b[i]
386 }
387
388 if int(v) < 2 {
389
390 if v == 0 {
391 b = append(b, cy.decimal...)
392 }
393
394 for i := 0; i < 2-int(v); i++ {
395 b = append(b, '0')
396 }
397 }
398
399 return string(b)
400 }
401
402
403
404 func (cy *cy_GB) FmtAccounting(num float64, v uint64, currency currency.Type) string {
405
406 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
407 symbol := cy.currencies[currency]
408 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
409 count := 0
410 inWhole := v == 0
411 b := make([]byte, 0, l)
412
413 for i := len(s) - 1; i >= 0; i-- {
414
415 if s[i] == '.' {
416 b = append(b, cy.decimal[0])
417 inWhole = true
418 continue
419 }
420
421 if inWhole {
422 if count == 3 {
423 b = append(b, cy.group[0])
424 count = 1
425 } else {
426 count++
427 }
428 }
429
430 b = append(b, s[i])
431 }
432
433 if num < 0 {
434
435 for j := len(symbol) - 1; j >= 0; j-- {
436 b = append(b, symbol[j])
437 }
438
439 b = append(b, cy.currencyNegativePrefix[0])
440
441 } else {
442
443 for j := len(symbol) - 1; j >= 0; j-- {
444 b = append(b, symbol[j])
445 }
446
447 }
448
449
450 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
451 b[i], b[j] = b[j], b[i]
452 }
453
454 if int(v) < 2 {
455
456 if v == 0 {
457 b = append(b, cy.decimal...)
458 }
459
460 for i := 0; i < 2-int(v); i++ {
461 b = append(b, '0')
462 }
463 }
464
465 if num < 0 {
466 b = append(b, cy.currencyNegativeSuffix...)
467 }
468
469 return string(b)
470 }
471
472
473 func (cy *cy_GB) FmtDateShort(t time.Time) string {
474
475 b := make([]byte, 0, 32)
476
477 if t.Day() < 10 {
478 b = append(b, '0')
479 }
480
481 b = strconv.AppendInt(b, int64(t.Day()), 10)
482 b = append(b, []byte{0x2f}...)
483
484 if t.Month() < 10 {
485 b = append(b, '0')
486 }
487
488 b = strconv.AppendInt(b, int64(t.Month()), 10)
489
490 b = append(b, []byte{0x2f}...)
491
492 if t.Year() > 9 {
493 b = append(b, strconv.Itoa(t.Year())[2:]...)
494 } else {
495 b = append(b, strconv.Itoa(t.Year())[1:]...)
496 }
497
498 return string(b)
499 }
500
501
502 func (cy *cy_GB) FmtDateMedium(t time.Time) string {
503
504 b := make([]byte, 0, 32)
505
506 b = strconv.AppendInt(b, int64(t.Day()), 10)
507 b = append(b, []byte{0x20}...)
508 b = append(b, cy.monthsAbbreviated[t.Month()]...)
509 b = append(b, []byte{0x20}...)
510
511 if t.Year() > 0 {
512 b = strconv.AppendInt(b, int64(t.Year()), 10)
513 } else {
514 b = strconv.AppendInt(b, int64(-t.Year()), 10)
515 }
516
517 return string(b)
518 }
519
520
521 func (cy *cy_GB) FmtDateLong(t time.Time) string {
522
523 b := make([]byte, 0, 32)
524
525 b = strconv.AppendInt(b, int64(t.Day()), 10)
526 b = append(b, []byte{0x20}...)
527 b = append(b, cy.monthsWide[t.Month()]...)
528 b = append(b, []byte{0x20}...)
529
530 if t.Year() > 0 {
531 b = strconv.AppendInt(b, int64(t.Year()), 10)
532 } else {
533 b = strconv.AppendInt(b, int64(-t.Year()), 10)
534 }
535
536 return string(b)
537 }
538
539
540 func (cy *cy_GB) FmtDateFull(t time.Time) string {
541
542 b := make([]byte, 0, 32)
543
544 b = append(b, cy.daysWide[t.Weekday()]...)
545 b = append(b, []byte{0x2c, 0x20}...)
546 b = strconv.AppendInt(b, int64(t.Day()), 10)
547 b = append(b, []byte{0x20}...)
548 b = append(b, cy.monthsWide[t.Month()]...)
549 b = append(b, []byte{0x20}...)
550
551 if t.Year() > 0 {
552 b = strconv.AppendInt(b, int64(t.Year()), 10)
553 } else {
554 b = strconv.AppendInt(b, int64(-t.Year()), 10)
555 }
556
557 return string(b)
558 }
559
560
561 func (cy *cy_GB) FmtTimeShort(t time.Time) string {
562
563 b := make([]byte, 0, 32)
564
565 if t.Hour() < 10 {
566 b = append(b, '0')
567 }
568
569 b = strconv.AppendInt(b, int64(t.Hour()), 10)
570 b = append(b, cy.timeSeparator...)
571
572 if t.Minute() < 10 {
573 b = append(b, '0')
574 }
575
576 b = strconv.AppendInt(b, int64(t.Minute()), 10)
577
578 return string(b)
579 }
580
581
582 func (cy *cy_GB) FmtTimeMedium(t time.Time) string {
583
584 b := make([]byte, 0, 32)
585
586 if t.Hour() < 10 {
587 b = append(b, '0')
588 }
589
590 b = strconv.AppendInt(b, int64(t.Hour()), 10)
591 b = append(b, cy.timeSeparator...)
592
593 if t.Minute() < 10 {
594 b = append(b, '0')
595 }
596
597 b = strconv.AppendInt(b, int64(t.Minute()), 10)
598 b = append(b, cy.timeSeparator...)
599
600 if t.Second() < 10 {
601 b = append(b, '0')
602 }
603
604 b = strconv.AppendInt(b, int64(t.Second()), 10)
605
606 return string(b)
607 }
608
609
610 func (cy *cy_GB) FmtTimeLong(t time.Time) string {
611
612 b := make([]byte, 0, 32)
613
614 if t.Hour() < 10 {
615 b = append(b, '0')
616 }
617
618 b = strconv.AppendInt(b, int64(t.Hour()), 10)
619 b = append(b, cy.timeSeparator...)
620
621 if t.Minute() < 10 {
622 b = append(b, '0')
623 }
624
625 b = strconv.AppendInt(b, int64(t.Minute()), 10)
626 b = append(b, cy.timeSeparator...)
627
628 if t.Second() < 10 {
629 b = append(b, '0')
630 }
631
632 b = strconv.AppendInt(b, int64(t.Second()), 10)
633 b = append(b, []byte{0x20}...)
634
635 tz, _ := t.Zone()
636 b = append(b, tz...)
637
638 return string(b)
639 }
640
641
642 func (cy *cy_GB) FmtTimeFull(t time.Time) string {
643
644 b := make([]byte, 0, 32)
645
646 if t.Hour() < 10 {
647 b = append(b, '0')
648 }
649
650 b = strconv.AppendInt(b, int64(t.Hour()), 10)
651 b = append(b, cy.timeSeparator...)
652
653 if t.Minute() < 10 {
654 b = append(b, '0')
655 }
656
657 b = strconv.AppendInt(b, int64(t.Minute()), 10)
658 b = append(b, cy.timeSeparator...)
659
660 if t.Second() < 10 {
661 b = append(b, '0')
662 }
663
664 b = strconv.AppendInt(b, int64(t.Second()), 10)
665 b = append(b, []byte{0x20}...)
666
667 tz, _ := t.Zone()
668
669 if btz, ok := cy.timezones[tz]; ok {
670 b = append(b, btz...)
671 } else {
672 b = append(b, tz...)
673 }
674
675 return string(b)
676 }
677
View as plain text