1package ps
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 ps 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 'ps' locale
45func New() locales.Translator {
46	return &ps{
47		locale:                 "ps",
48		pluralsCardinal:        []locales.PluralRule{2, 6},
49		pluralsOrdinal:         []locales.PluralRule{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", "؋", "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", "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", "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", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "NT$", "TZS", "UAH", "UAK", "UGS", "UGX", "US$", "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{"", "جنوري", "فبروري", "مارچ", "اپریل", "مۍ", "جون", "جولای", "اگست", "سېپتمبر", "اکتوبر", "نومبر", "دسمبر"},
62		monthsNarrow:           []string{"", "ج", "ف", "م", "ا", "م", "ج", "ج", "ا", "س", "ا", "ن", "د"},
63		monthsWide:             []string{"", "جنوري", "فبروري", "مارچ", "اپریل", "مۍ", "جون", "جولای", "اگست", "سېپتمبر", "اکتوبر", "نومبر", "دسمبر"},
64		daysAbbreviated:        []string{"يونۍ", "دونۍ", "درېنۍ", "څلرنۍ", "پينځنۍ", "جمعه", "اونۍ"},
65		daysNarrow:             []string{"S", "M", "T", "W", "T", "F", "S"},
66		daysShort:              []string{"يونۍ", "دونۍ", "درېنۍ", "څلرنۍ", "پينځنۍ", "جمعه", "اونۍ"},
67		daysWide:               []string{"يونۍ", "دونۍ", "درېنۍ", "څلرنۍ", "پينځنۍ", "جمعه", "اونۍ"},
68		periodsAbbreviated:     []string{"غ.م.", "غ.و."},
69		periodsNarrow:          []string{"غ.م.", "غ.و."},
70		periodsWide:            []string{"غ.م.", "غ.و."},
71		erasAbbreviated:        []string{"له میلاد وړاندې", "م."},
72		erasNarrow:             []string{"", ""},
73		erasWide:               []string{"له میلاد څخه وړاندې", "له میلاد څخه وروسته"},
74		timezones:              map[string]string{"MESZ": "د مرکزي اروپا د اوړي وخت", "HNT": "د نوي فیلډلینډ معیاری وخت", "VET": "وینزویلا وخت", "PDT": "پیسفک د رڼا ورځې وخت", "CLT": "چلی معیاری وخت", "COST": "کولمبیا اوړي وخت", "WAT": "لویدیځ افریقایي معیاري وخت", "NZDT": "د نیوزی لینڈ د ورځې د رڼا وخت", "AKST": "الاسکا معياري وخت", "HNPM": "سینټ پییرا و ميکلين معیاری وخت", "HNCU": "کیوبا معياري وخت", "ACWST": "د آسټرالیا مرکزي لویدیځ معیاري وخت", "LHDT": "رب هاو د ورځې د رڼا وخت", "HENOMX": "د شمال لویدیځ مکسیکو رڼا ورځې وخت", "ACDT": "د آسټرالیا مرکزي مرکزی ورځ", "ACWDT": "د آسټرالیا مرکزي مرکزی لویدیځ د وخت وخت", "∅∅∅": "Azores سمر وخت", "TMST": "ترکمنستان اوړي وخت", "COT": "کولمبیا معیاری وخت", "GYT": "د ګوانانا وخت", "ADT": "اتلانتیک د رڼا ورځې وخت", "BT": "د بوتان وخت", "EAT": "ختيځ افريقا وخت", "OESZ": "Eastern European Summer Time", "ARST": "ارجنټاین اوړي وخت", "UYT": "یوروګوای معياري وخت", "AWST": "د اسټرالیا لویدیز معیار", "AEST": "د آسټرالیا ختیځ معیاري وخت", "SAST": "جنوبي افريقا معياري وخت", "EDT": "ختيځ د رڼا ورځې وخت", "HEOG": "لویدیځ ګرینلینډ اوړي وخت", "HNNOMX": "د شمال لویدیځ مکسیکو معیاري وخت", "WIT": "د اندونیزیا وخت", "ChST": "چمارو معياري وخت", "WEZ": "د لودیځې اروپا معیاري وخت", "ECT": "د اکوادور وخت", "HKT": "د هانګ کانګ معياري وخت", "CAT": "منځنی افريقا وخت", "ART": "ارجنټاین معیاری وخت", "AWDT": "د اسټرالیا لویدیځ د ورځې وخت", "GFT": "د فرانسوي ګانا وخت", "JDT": "جاپان د رڼا ورځې وخت", "MEZ": "د مرکزي اروپا معیاري وخت", "WITA": "د اندونیزیا مرکزي وخت", "HAST": "هوایی الیوتین معیاری وخت", "UYST": "یوروګوای اوړي وخت", "HNPMX": "مکسیکن پیسفک معیاری وخت", "EST": "ختيځ معياري وخت", "HNEG": "د ختیځ ګرینلینډ معياري وخت", "HKST": "د هانګ کانګ اوړي وخت", "WART": "غربي ارجنټاین معیاری وخت", "WARST": "غربي ارجنټاین اوړي وخت", "HAT": "د نوي فیلډلینډ رڼا ورځې وخت", "MDT": "MDT", "CDT": "مرکزي رڼا ورځې وخت", "MYT": "ملائیشیا وخت", "TMT": "ترکمنستان معياري وخت", "GMT": "گرينويچ وخت", "AEDT": "د اسټرالیا ختیځ ختیځ ورځی وخت", "NZST": "د نیوزی لینڈ معیاري وخت", "SRT": "سورینام وخت", "HECU": "کیوبا د رڼا ورځې وخت", "CST": "مرکزي معياري وخت", "PST": "د پیسفک معياري وخت", "ACST": "د اسټرالیا مرکزي مرکزي معیار", "HEEG": "د ختیځ ګرینلینډ اوړي وخت", "MST": "MST", "OEZ": "Eastern European Standard Time", "HADT": "هوایی الیوتین رڼا ورځې وخت", "BOT": "بولیویا وخت", "JST": "د جاپان معياري وخت", "IST": "د هند معیاري وخت", "WAST": "د افریقا افریقا لویدیځ وخت", "WESZ": "د لودیځې اورپا د اوړي وخت", "HNOG": "لویدیځ ګرینلینډ معياري وخت", "LHST": "رب های معیاري وخت", "HEPM": "سینټ پییرا و ميکلين رڼا ورځې وخت", "CLST": "چلی اوړي وخت", "CHAST": "د چمتم معياري وخت", "CHADT": "د چتام ورځی وخت", "WIB": "د لویدیځ اندونیزیا وخت", "SGT": "د سنګاپور معیاري وخت", "HEPMX": "مکسیکن پیسفک رڼا ورځې وخت", "AST": "اتلانتیک معياري وخت", "AKDT": "د الاسکا د ورځې روښانه کول"},
75	}
76}
77
78// Locale returns the current translators string locale
79func (ps *ps) Locale() string {
80	return ps.locale
81}
82
83// PluralsCardinal returns the list of cardinal plural rules associated with 'ps'
84func (ps *ps) PluralsCardinal() []locales.PluralRule {
85	return ps.pluralsCardinal
86}
87
88// PluralsOrdinal returns the list of ordinal plural rules associated with 'ps'
89func (ps *ps) PluralsOrdinal() []locales.PluralRule {
90	return ps.pluralsOrdinal
91}
92
93// PluralsRange returns the list of range plural rules associated with 'ps'
94func (ps *ps) PluralsRange() []locales.PluralRule {
95	return ps.pluralsRange
96}
97
98// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ps'
99func (ps *ps) 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// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ps'
111func (ps *ps) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112	return locales.PluralRuleOther
113}
114
115// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ps'
116func (ps *ps) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
117
118	start := ps.CardinalPluralRule(num1, v1)
119	end := ps.CardinalPluralRule(num2, v2)
120
121	if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
122		return locales.PluralRuleOne
123	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
124		return locales.PluralRuleOther
125	}
126
127	return locales.PluralRuleOther
128
129}
130
131// MonthAbbreviated returns the locales abbreviated month given the 'month' provided
132func (ps *ps) MonthAbbreviated(month time.Month) string {
133	return ps.monthsAbbreviated[month]
134}
135
136// MonthsAbbreviated returns the locales abbreviated months
137func (ps *ps) MonthsAbbreviated() []string {
138	return ps.monthsAbbreviated[1:]
139}
140
141// MonthNarrow returns the locales narrow month given the 'month' provided
142func (ps *ps) MonthNarrow(month time.Month) string {
143	return ps.monthsNarrow[month]
144}
145
146// MonthsNarrow returns the locales narrow months
147func (ps *ps) MonthsNarrow() []string {
148	return ps.monthsNarrow[1:]
149}
150
151// MonthWide returns the locales wide month given the 'month' provided
152func (ps *ps) MonthWide(month time.Month) string {
153	return ps.monthsWide[month]
154}
155
156// MonthsWide returns the locales wide months
157func (ps *ps) MonthsWide() []string {
158	return ps.monthsWide[1:]
159}
160
161// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
162func (ps *ps) WeekdayAbbreviated(weekday time.Weekday) string {
163	return ps.daysAbbreviated[weekday]
164}
165
166// WeekdaysAbbreviated returns the locales abbreviated weekdays
167func (ps *ps) WeekdaysAbbreviated() []string {
168	return ps.daysAbbreviated
169}
170
171// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
172func (ps *ps) WeekdayNarrow(weekday time.Weekday) string {
173	return ps.daysNarrow[weekday]
174}
175
176// WeekdaysNarrow returns the locales narrow weekdays
177func (ps *ps) WeekdaysNarrow() []string {
178	return ps.daysNarrow
179}
180
181// WeekdayShort returns the locales short weekday given the 'weekday' provided
182func (ps *ps) WeekdayShort(weekday time.Weekday) string {
183	return ps.daysShort[weekday]
184}
185
186// WeekdaysShort returns the locales short weekdays
187func (ps *ps) WeekdaysShort() []string {
188	return ps.daysShort
189}
190
191// WeekdayWide returns the locales wide weekday given the 'weekday' provided
192func (ps *ps) WeekdayWide(weekday time.Weekday) string {
193	return ps.daysWide[weekday]
194}
195
196// WeekdaysWide returns the locales wide weekdays
197func (ps *ps) WeekdaysWide() []string {
198	return ps.daysWide
199}
200
201// Decimal returns the decimal point of number
202func (ps *ps) Decimal() string {
203	return ps.decimal
204}
205
206// Group returns the group of number
207func (ps *ps) Group() string {
208	return ps.group
209}
210
211// Group returns the minus sign of number
212func (ps *ps) Minus() string {
213	return ps.minus
214}
215
216// FmtNumber returns 'num' with digits/precision of 'v' for 'ps' and handles both Whole and Real numbers based on 'v'
217func (ps *ps) FmtNumber(num float64, v uint64) string {
218
219	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
220	l := len(s) + 9 + 2*len(s[:len(s)-int(v)-1])/3
221	count := 0
222	inWhole := v == 0
223	b := make([]byte, 0, l)
224
225	for i := len(s) - 1; i >= 0; i-- {
226
227		if s[i] == '.' {
228			for j := len(ps.decimal) - 1; j >= 0; j-- {
229				b = append(b, ps.decimal[j])
230			}
231			inWhole = true
232			continue
233		}
234
235		if inWhole {
236			if count == 3 {
237				for j := len(ps.group) - 1; j >= 0; j-- {
238					b = append(b, ps.group[j])
239				}
240				count = 1
241			} else {
242				count++
243			}
244		}
245
246		b = append(b, s[i])
247	}
248
249	if num < 0 {
250		for j := len(ps.minus) - 1; j >= 0; j-- {
251			b = append(b, ps.minus[j])
252		}
253	}
254
255	// reverse
256	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
257		b[i], b[j] = b[j], b[i]
258	}
259
260	return string(b)
261}
262
263// FmtPercent returns 'num' with digits/precision of 'v' for 'ps' and handles both Whole and Real numbers based on 'v'
264// NOTE: 'num' passed into FmtPercent is assumed to be in percent already
265func (ps *ps) FmtPercent(num float64, v uint64) string {
266	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
267	l := len(s) + 11
268	b := make([]byte, 0, l)
269
270	for i := len(s) - 1; i >= 0; i-- {
271
272		if s[i] == '.' {
273			for j := len(ps.decimal) - 1; j >= 0; j-- {
274				b = append(b, ps.decimal[j])
275			}
276			continue
277		}
278
279		b = append(b, s[i])
280	}
281
282	if num < 0 {
283		for j := len(ps.minus) - 1; j >= 0; j-- {
284			b = append(b, ps.minus[j])
285		}
286	}
287
288	// reverse
289	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
290		b[i], b[j] = b[j], b[i]
291	}
292
293	b = append(b, ps.percent...)
294
295	return string(b)
296}
297
298// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ps'
299func (ps *ps) FmtCurrency(num float64, v uint64, currency currency.Type) string {
300
301	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
302	symbol := ps.currencies[currency]
303	l := len(s) + len(symbol) + 11 + 2*len(s[:len(s)-int(v)-1])/3
304	count := 0
305	inWhole := v == 0
306	b := make([]byte, 0, l)
307
308	for i := len(s) - 1; i >= 0; i-- {
309
310		if s[i] == '.' {
311			for j := len(ps.decimal) - 1; j >= 0; j-- {
312				b = append(b, ps.decimal[j])
313			}
314			inWhole = true
315			continue
316		}
317
318		if inWhole {
319			if count == 3 {
320				for j := len(ps.group) - 1; j >= 0; j-- {
321					b = append(b, ps.group[j])
322				}
323				count = 1
324			} else {
325				count++
326			}
327		}
328
329		b = append(b, s[i])
330	}
331
332	if num < 0 {
333		for j := len(ps.minus) - 1; j >= 0; j-- {
334			b = append(b, ps.minus[j])
335		}
336	}
337
338	// reverse
339	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
340		b[i], b[j] = b[j], b[i]
341	}
342
343	if int(v) < 2 {
344
345		if v == 0 {
346			b = append(b, ps.decimal...)
347		}
348
349		for i := 0; i < 2-int(v); i++ {
350			b = append(b, '0')
351		}
352	}
353
354	b = append(b, ps.currencyPositiveSuffix...)
355
356	b = append(b, symbol...)
357
358	return string(b)
359}
360
361// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ps'
362// in accounting notation.
363func (ps *ps) FmtAccounting(num float64, v uint64, currency currency.Type) string {
364
365	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
366	symbol := ps.currencies[currency]
367	l := len(s) + len(symbol) + 11 + 2*len(s[:len(s)-int(v)-1])/3
368	count := 0
369	inWhole := v == 0
370	b := make([]byte, 0, l)
371
372	for i := len(s) - 1; i >= 0; i-- {
373
374		if s[i] == '.' {
375			for j := len(ps.decimal) - 1; j >= 0; j-- {
376				b = append(b, ps.decimal[j])
377			}
378			inWhole = true
379			continue
380		}
381
382		if inWhole {
383			if count == 3 {
384				for j := len(ps.group) - 1; j >= 0; j-- {
385					b = append(b, ps.group[j])
386				}
387				count = 1
388			} else {
389				count++
390			}
391		}
392
393		b = append(b, s[i])
394	}
395
396	if num < 0 {
397
398		for j := len(ps.minus) - 1; j >= 0; j-- {
399			b = append(b, ps.minus[j])
400		}
401
402	}
403
404	// reverse
405	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
406		b[i], b[j] = b[j], b[i]
407	}
408
409	if int(v) < 2 {
410
411		if v == 0 {
412			b = append(b, ps.decimal...)
413		}
414
415		for i := 0; i < 2-int(v); i++ {
416			b = append(b, '0')
417		}
418	}
419
420	if num < 0 {
421		b = append(b, ps.currencyNegativeSuffix...)
422		b = append(b, symbol...)
423	} else {
424
425		b = append(b, ps.currencyPositiveSuffix...)
426		b = append(b, symbol...)
427	}
428
429	return string(b)
430}
431
432// FmtDateShort returns the short date representation of 't' for 'ps'
433func (ps *ps) FmtDateShort(t time.Time) string {
434
435	b := make([]byte, 0, 32)
436
437	if t.Year() > 0 {
438		b = strconv.AppendInt(b, int64(t.Year()), 10)
439	} else {
440		b = strconv.AppendInt(b, int64(-t.Year()), 10)
441	}
442
443	b = append(b, []byte{0x2f}...)
444	b = strconv.AppendInt(b, int64(t.Month()), 10)
445	b = append(b, []byte{0x2f}...)
446	b = strconv.AppendInt(b, int64(t.Day()), 10)
447
448	return string(b)
449}
450
451// FmtDateMedium returns the medium date representation of 't' for 'ps'
452func (ps *ps) FmtDateMedium(t time.Time) string {
453
454	b := make([]byte, 0, 32)
455
456	if t.Year() > 0 {
457		b = strconv.AppendInt(b, int64(t.Year()), 10)
458	} else {
459		b = strconv.AppendInt(b, int64(-t.Year()), 10)
460	}
461
462	b = append(b, []byte{0x20}...)
463	b = append(b, ps.monthsAbbreviated[t.Month()]...)
464	b = append(b, []byte{0x20}...)
465	b = strconv.AppendInt(b, int64(t.Day()), 10)
466
467	return string(b)
468}
469
470// FmtDateLong returns the long date representation of 't' for 'ps'
471func (ps *ps) FmtDateLong(t time.Time) string {
472
473	b := make([]byte, 0, 32)
474
475	b = append(b, []byte{0xd8, 0xaf, 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	b = append(b, []byte{0x20, 0xd8, 0xaf, 0x20}...)
484	b = append(b, ps.monthsWide[t.Month()]...)
485	b = append(b, []byte{0x20}...)
486	b = strconv.AppendInt(b, int64(t.Day()), 10)
487
488	return string(b)
489}
490
491// FmtDateFull returns the full date representation of 't' for 'ps'
492func (ps *ps) FmtDateFull(t time.Time) string {
493
494	b := make([]byte, 0, 32)
495
496	b = append(b, ps.daysWide[t.Weekday()]...)
497	b = append(b, []byte{0x20, 0xd8, 0xaf, 0x20}...)
498
499	if t.Year() > 0 {
500		b = strconv.AppendInt(b, int64(t.Year()), 10)
501	} else {
502		b = strconv.AppendInt(b, int64(-t.Year()), 10)
503	}
504
505	b = append(b, []byte{0x20, 0xd8, 0xaf, 0x20}...)
506	b = append(b, ps.monthsWide[t.Month()]...)
507	b = append(b, []byte{0x20}...)
508	b = strconv.AppendInt(b, int64(t.Day()), 10)
509
510	return string(b)
511}
512
513// FmtTimeShort returns the short time representation of 't' for 'ps'
514func (ps *ps) FmtTimeShort(t time.Time) string {
515
516	b := make([]byte, 0, 32)
517
518	b = strconv.AppendInt(b, int64(t.Hour()), 10)
519	b = append(b, ps.timeSeparator...)
520
521	if t.Minute() < 10 {
522		b = append(b, '0')
523	}
524
525	b = strconv.AppendInt(b, int64(t.Minute()), 10)
526
527	return string(b)
528}
529
530// FmtTimeMedium returns the medium time representation of 't' for 'ps'
531func (ps *ps) FmtTimeMedium(t time.Time) string {
532
533	b := make([]byte, 0, 32)
534
535	b = strconv.AppendInt(b, int64(t.Hour()), 10)
536	b = append(b, ps.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, ps.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 'ps'
555func (ps *ps) FmtTimeLong(t time.Time) string {
556
557	b := make([]byte, 0, 32)
558
559	b = strconv.AppendInt(b, int64(t.Hour()), 10)
560	b = append(b, ps.timeSeparator...)
561
562	if t.Minute() < 10 {
563		b = append(b, '0')
564	}
565
566	b = strconv.AppendInt(b, int64(t.Minute()), 10)
567	b = append(b, ps.timeSeparator...)
568
569	if t.Second() < 10 {
570		b = append(b, '0')
571	}
572
573	b = strconv.AppendInt(b, int64(t.Second()), 10)
574	b = append(b, []byte{0x20, 0x28}...)
575
576	tz, _ := t.Zone()
577	b = append(b, tz...)
578
579	b = append(b, []byte{0x29}...)
580
581	return string(b)
582}
583
584// FmtTimeFull returns the full time representation of 't' for 'ps'
585func (ps *ps) FmtTimeFull(t time.Time) string {
586
587	b := make([]byte, 0, 32)
588
589	b = strconv.AppendInt(b, int64(t.Hour()), 10)
590	b = append(b, ps.timeSeparator...)
591
592	if t.Minute() < 10 {
593		b = append(b, '0')
594	}
595
596	b = strconv.AppendInt(b, int64(t.Minute()), 10)
597	b = append(b, ps.timeSeparator...)
598
599	if t.Second() < 10 {
600		b = append(b, '0')
601	}
602
603	b = strconv.AppendInt(b, int64(t.Second()), 10)
604	b = append(b, []byte{0x20, 0x28}...)
605
606	tz, _ := t.Zone()
607
608	if btz, ok := ps.timezones[tz]; ok {
609		b = append(b, btz...)
610	} else {
611		b = append(b, tz...)
612	}
613
614	b = append(b, []byte{0x29}...)
615
616	return string(b)
617}
618