1 package mr_IN
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 mr_IN 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 monthsAbbreviated []string
26 monthsNarrow []string
27 monthsWide []string
28 daysAbbreviated []string
29 daysNarrow []string
30 daysShort []string
31 daysWide []string
32 periodsAbbreviated []string
33 periodsNarrow []string
34 periodsShort []string
35 periodsWide []string
36 erasAbbreviated []string
37 erasNarrow []string
38 erasWide []string
39 timezones map[string]string
40 }
41
42
43 func New() locales.Translator {
44 return &mr_IN{
45 locale: "mr_IN",
46 pluralsCardinal: []locales.PluralRule{2, 6},
47 pluralsOrdinal: []locales.PluralRule{2, 3, 4, 6},
48 pluralsRange: []locales.PluralRule{2, 6},
49 decimal: ".",
50 group: ",",
51 minus: "-",
52 percent: "%",
53 perMille: "‰",
54 timeSeparator: ":",
55 inifinity: "∞",
56 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"},
57 monthsAbbreviated: []string{"", "जाने", "फेब्रु", "मार्च", "एप्रि", "मे", "जून", "जुलै", "ऑग", "सप्टें", "ऑक्टो", "नोव्हें", "डिसें"},
58 monthsNarrow: []string{"", "जा", "फे", "मा", "ए", "मे", "जू", "जु", "ऑ", "स", "ऑ", "नो", "डि"},
59 monthsWide: []string{"", "जानेवारी", "फेब्रुवारी", "मार्च", "एप्रिल", "मे", "जून", "जुलै", "ऑगस्ट", "सप्टेंबर", "ऑक्टोबर", "नोव्हेंबर", "डिसेंबर"},
60 daysAbbreviated: []string{"रवि", "सोम", "मंगळ", "बुध", "गुरु", "शुक्र", "शनि"},
61 daysNarrow: []string{"र", "सो", "मं", "बु", "गु", "शु", "श"},
62 daysShort: []string{"र", "सो", "मं", "बु", "गु", "शु", "श"},
63 daysWide: []string{"रविवार", "सोमवार", "मंगळवार", "बुधवार", "गुरुवार", "शुक्रवार", "शनिवार"},
64 periodsAbbreviated: []string{"म.पू.", "म.उ."},
65 periodsNarrow: []string{"स", "सं"},
66 periodsWide: []string{"म.पू.", "म.उ."},
67 erasAbbreviated: []string{"इ. स. पू.", "इ. स."},
68 erasNarrow: []string{"", ""},
69 erasWide: []string{"ईसवीसनपूर्व", "ईसवीसन"},
70 timezones: map[string]string{"ACDT": "ऑस्ट्रेलियन मध्य सूर्यप्रकाश वेळ", "ACST": "ऑस्ट्रेलियन मध्य प्रमाण वेळ", "ACWDT": "ऑस्ट्रेलियन मध्य-पश्चिम सूर्यप्रकाश वेळ", "ACWST": "ऑस्ट्रेलियन मध्य-पश्चिम प्रमाण वेळ", "ADT": "अटलांटिक सूर्यप्रकाश वेळ", "AEDT": "ऑस्ट्रेलियन पूर्व सूर्यप्रकाश वेळ", "AEST": "ऑस्ट्रेलियन पूर्व प्रमाण वेळ", "AKDT": "अलास्का सूर्यप्रकाश वेळ", "AKST": "अलास्का प्रमाण वेळ", "ARST": "अर्जेंटिना उन्हाळी वेळ", "ART": "अर्जेंटिना प्रमाण वेळ", "AST": "अटलांटिक प्रमाण वेळ", "AWDT": "ऑस्ट्रेलियन पश्चिम सूर्यप्रकाश वेळ", "AWST": "ऑस्ट्रेलियन पश्चिम प्रमाण वेळ", "BOT": "बोलिव्हिया वेळ", "BT": "भूतान वेळ", "CAT": "मध्\u200dय आफ्रिका वेळ", "CDT": "केंद्रीय सूर्यप्रकाश वेळ", "CHADT": "चॅथम सूर्यप्रकाश वेळ", "CHAST": "चॅथम प्रमाण वेळ", "CLST": "चिली उन्हाळी वेळ", "CLT": "चिली प्रमाण वेळ", "COST": "कोलंबिया उन्हाळी वेळ", "COT": "कोलंबिया प्रमाण वेळ", "CST": "केंद्रीय प्रमाण वेळ", "ChST": "चामोरो प्रमाण वेळ", "EAT": "पूर्व आफ्रिका वेळ", "ECT": "इक्वेडोर वेळ", "EDT": "पौर्वात्य सूर्यप्रकाश वेळ", "EST": "पौर्वात्य प्रमाण वेळ", "GFT": "फ्रेंच गयाना वेळ", "GMT": "ग्रीनिच प्रमाण वेळ", "GST": "खाडी प्रमाण वेळ", "GYT": "गयाना वेळ", "HADT": "हवाई-अलूशन सूर्यप्रकाश वेळ", "HAST": "हवाई-अलूशन प्रमाण वेळ", "HAT": "न्यू फाउंडलंड सूर्यप्रकाश वेळ", "HECU": "क्यूबा सूर्यप्रकाश वेळ", "HEEG": "पूर्व ग्रीनलँड उन्हाळी वेळ", "HENOMX": "वायव्य मेक्सिको सूर्यप्रकाश वेळ", "HEOG": "पश्चिम ग्रीनलँड उन्हाळी वेळ", "HEPM": "सेंट पियरे आणि मिक्वेलोन सूर्यप्रकाश वेळ", "HEPMX": "मेक्सिको पॅसिफिक सूर्यप्रकाश वेळ", "HKST": "हाँग काँग उन्हाळी वेळ", "HKT": "हाँग काँग प्रमाण वेळ", "HNCU": "क्यूबा प्रमाण वेळ", "HNEG": "पूर्व ग्रीनलँड प्रमाण वेळ", "HNNOMX": "वायव्य मेक्सिको प्रमाण वेळ", "HNOG": "पश्चिम ग्रीनलँड प्रमाण वेळ", "HNPM": "सेंट पियरे आणि मिक्वेलोन प्रमाण वेळ", "HNPMX": "मेक्सिको पॅसिफिक प्रमाण वेळ", "HNT": "न्यू फाउंडलंड प्रमाण वेळ", "IST": "भारतीय प्रमाण वेळ", "JDT": "जपान सूर्यप्रकाश वेळ", "JST": "जपान प्रमाण वेळ", "LHDT": "लॉर्ड होवे सूर्यप्रकाश वेळ", "LHST": "लॉर्ड होवे प्रमाण वेळ", "MDT": "पर्वतीय सूर्यप्रकाश वेळ", "MESZ": "मध्\u200dय युरोपियन उन्हाळी वेळ", "MEZ": "मध्\u200dय युरोपियन प्रमाण वेळ", "MST": "पर्वतीय प्रमाण वेळ", "MYT": "मलेशिया वेळ", "NZDT": "न्यूझीलंड सूर्यप्रकाश वेळ", "NZST": "न्यूझीलंड प्रमाण वेळ", "OESZ": "पूर्व युरोपियन उन्हाळी वेळ", "OEZ": "पूर्व युरोपियन प्रमाण वेळ", "PDT": "पॅसिफिक सूर्यप्रकाश वेळ", "PST": "पॅसिफिक प्रमाण वेळ", "SAST": "दक्षिण आफ्रिका प्रमाण वेळ", "SGT": "सिंगापूर प्रमाण वेळ", "SRT": "सुरिनाम वेळ", "TMST": "तुर्कमेनिस्तान उन्हाळी वेळ", "TMT": "तुर्कमेनिस्तान प्रमाण वेळ", "UYST": "उरुग्वे उन्हाळी वेळ", "UYT": "उरुग्वे प्रमाण वेळ", "VET": "व्हेनेझुएला वेळ", "WARST": "पश्चिमी अर्जेंटिना उन्हाळी वेळ", "WART": "पश्चिमी अर्जेंटिना प्रमाण वेळ", "WAST": "पश्चिम आफ्रिका उन्हाळी वेळ", "WAT": "पश्चिम आफ्रिका प्रमाण वेळ", "WESZ": "पश्चिम युरोपियन उन्हाळी वेळ", "WEZ": "पश्चिम युरोपियन प्रमाण वेळ", "WIB": "पश्चिमी इंडोनेशिया वेळ", "WIT": "पौर्वात्य इंडोनेशिया वेळ", "WITA": "मध्\u200dय इंडोनेशिया वेळ", "∅∅∅": "अ\u200dॅझोरेस उन्हाळी वेळ"},
71 }
72 }
73
74
75 func (mr *mr_IN) Locale() string {
76 return mr.locale
77 }
78
79
80 func (mr *mr_IN) PluralsCardinal() []locales.PluralRule {
81 return mr.pluralsCardinal
82 }
83
84
85 func (mr *mr_IN) PluralsOrdinal() []locales.PluralRule {
86 return mr.pluralsOrdinal
87 }
88
89
90 func (mr *mr_IN) PluralsRange() []locales.PluralRule {
91 return mr.pluralsRange
92 }
93
94
95 func (mr *mr_IN) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
96
97 n := math.Abs(num)
98
99 if n == 1 {
100 return locales.PluralRuleOne
101 }
102
103 return locales.PluralRuleOther
104 }
105
106
107 func (mr *mr_IN) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
108
109 n := math.Abs(num)
110
111 if n == 1 {
112 return locales.PluralRuleOne
113 } else if n == 2 || n == 3 {
114 return locales.PluralRuleTwo
115 } else if n == 4 {
116 return locales.PluralRuleFew
117 }
118
119 return locales.PluralRuleOther
120 }
121
122
123 func (mr *mr_IN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
124
125 start := mr.CardinalPluralRule(num1, v1)
126 end := mr.CardinalPluralRule(num2, v2)
127
128 if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
129 return locales.PluralRuleOne
130 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
131 return locales.PluralRuleOther
132 }
133
134 return locales.PluralRuleOther
135
136 }
137
138
139 func (mr *mr_IN) MonthAbbreviated(month time.Month) string {
140 return mr.monthsAbbreviated[month]
141 }
142
143
144 func (mr *mr_IN) MonthsAbbreviated() []string {
145 return mr.monthsAbbreviated[1:]
146 }
147
148
149 func (mr *mr_IN) MonthNarrow(month time.Month) string {
150 return mr.monthsNarrow[month]
151 }
152
153
154 func (mr *mr_IN) MonthsNarrow() []string {
155 return mr.monthsNarrow[1:]
156 }
157
158
159 func (mr *mr_IN) MonthWide(month time.Month) string {
160 return mr.monthsWide[month]
161 }
162
163
164 func (mr *mr_IN) MonthsWide() []string {
165 return mr.monthsWide[1:]
166 }
167
168
169 func (mr *mr_IN) WeekdayAbbreviated(weekday time.Weekday) string {
170 return mr.daysAbbreviated[weekday]
171 }
172
173
174 func (mr *mr_IN) WeekdaysAbbreviated() []string {
175 return mr.daysAbbreviated
176 }
177
178
179 func (mr *mr_IN) WeekdayNarrow(weekday time.Weekday) string {
180 return mr.daysNarrow[weekday]
181 }
182
183
184 func (mr *mr_IN) WeekdaysNarrow() []string {
185 return mr.daysNarrow
186 }
187
188
189 func (mr *mr_IN) WeekdayShort(weekday time.Weekday) string {
190 return mr.daysShort[weekday]
191 }
192
193
194 func (mr *mr_IN) WeekdaysShort() []string {
195 return mr.daysShort
196 }
197
198
199 func (mr *mr_IN) WeekdayWide(weekday time.Weekday) string {
200 return mr.daysWide[weekday]
201 }
202
203
204 func (mr *mr_IN) WeekdaysWide() []string {
205 return mr.daysWide
206 }
207
208
209 func (mr *mr_IN) Decimal() string {
210 return mr.decimal
211 }
212
213
214 func (mr *mr_IN) Group() string {
215 return mr.group
216 }
217
218
219 func (mr *mr_IN) Minus() string {
220 return mr.minus
221 }
222
223
224 func (mr *mr_IN) FmtNumber(num float64, v uint64) string {
225
226 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
227 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
228 count := 0
229 inWhole := v == 0
230 inSecondary := false
231 groupThreshold := 3
232
233 b := make([]byte, 0, l)
234
235 for i := len(s) - 1; i >= 0; i-- {
236
237 if s[i] == '.' {
238 b = append(b, mr.decimal[0])
239 inWhole = true
240 continue
241 }
242
243 if inWhole {
244
245 if count == groupThreshold {
246 b = append(b, mr.group[0])
247 count = 1
248
249 if !inSecondary {
250 inSecondary = true
251 groupThreshold = 2
252 }
253 } else {
254 count++
255 }
256 }
257
258 b = append(b, s[i])
259 }
260
261 if num < 0 {
262 b = append(b, mr.minus[0])
263 }
264
265
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 return string(b)
271 }
272
273
274
275 func (mr *mr_IN) FmtPercent(num float64, v uint64) string {
276 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
277 l := len(s) + 3
278 b := make([]byte, 0, l)
279
280 for i := len(s) - 1; i >= 0; i-- {
281
282 if s[i] == '.' {
283 b = append(b, mr.decimal[0])
284 continue
285 }
286
287 b = append(b, s[i])
288 }
289
290 if num < 0 {
291 b = append(b, mr.minus[0])
292 }
293
294
295 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
296 b[i], b[j] = b[j], b[i]
297 }
298
299 b = append(b, mr.percent...)
300
301 return string(b)
302 }
303
304
305 func (mr *mr_IN) FmtCurrency(num float64, v uint64, currency currency.Type) string {
306
307 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
308 symbol := mr.currencies[currency]
309 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
310 count := 0
311 inWhole := v == 0
312 b := make([]byte, 0, l)
313
314 for i := len(s) - 1; i >= 0; i-- {
315
316 if s[i] == '.' {
317 b = append(b, mr.decimal[0])
318 inWhole = true
319 continue
320 }
321
322 if inWhole {
323 if count == 3 {
324 b = append(b, mr.group[0])
325 count = 1
326 } else {
327 count++
328 }
329 }
330
331 b = append(b, s[i])
332 }
333
334 for j := len(symbol) - 1; j >= 0; j-- {
335 b = append(b, symbol[j])
336 }
337
338 if num < 0 {
339 b = append(b, mr.minus[0])
340 }
341
342
343 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
344 b[i], b[j] = b[j], b[i]
345 }
346
347 if int(v) < 2 {
348
349 if v == 0 {
350 b = append(b, mr.decimal...)
351 }
352
353 for i := 0; i < 2-int(v); i++ {
354 b = append(b, '0')
355 }
356 }
357
358 return string(b)
359 }
360
361
362
363 func (mr *mr_IN) FmtAccounting(num float64, v uint64, currency currency.Type) string {
364
365 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
366 symbol := mr.currencies[currency]
367 l := len(s) + len(symbol) + 2 + 1*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 b = append(b, mr.decimal[0])
376 inWhole = true
377 continue
378 }
379
380 if inWhole {
381 if count == 3 {
382 b = append(b, mr.group[0])
383 count = 1
384 } else {
385 count++
386 }
387 }
388
389 b = append(b, s[i])
390 }
391
392 if num < 0 {
393
394 for j := len(symbol) - 1; j >= 0; j-- {
395 b = append(b, symbol[j])
396 }
397
398 b = append(b, mr.minus[0])
399
400 } else {
401
402 for j := len(symbol) - 1; j >= 0; j-- {
403 b = append(b, symbol[j])
404 }
405
406 }
407
408
409 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
410 b[i], b[j] = b[j], b[i]
411 }
412
413 if int(v) < 2 {
414
415 if v == 0 {
416 b = append(b, mr.decimal...)
417 }
418
419 for i := 0; i < 2-int(v); i++ {
420 b = append(b, '0')
421 }
422 }
423
424 return string(b)
425 }
426
427
428 func (mr *mr_IN) FmtDateShort(t time.Time) string {
429
430 b := make([]byte, 0, 32)
431
432 b = strconv.AppendInt(b, int64(t.Day()), 10)
433 b = append(b, []byte{0x2f}...)
434 b = strconv.AppendInt(b, int64(t.Month()), 10)
435 b = append(b, []byte{0x2f}...)
436
437 if t.Year() > 9 {
438 b = append(b, strconv.Itoa(t.Year())[2:]...)
439 } else {
440 b = append(b, strconv.Itoa(t.Year())[1:]...)
441 }
442
443 return string(b)
444 }
445
446
447 func (mr *mr_IN) FmtDateMedium(t time.Time) string {
448
449 b := make([]byte, 0, 32)
450
451 b = strconv.AppendInt(b, int64(t.Day()), 10)
452 b = append(b, []byte{0x20}...)
453 b = append(b, mr.monthsAbbreviated[t.Month()]...)
454 b = append(b, []byte{0x2c, 0x20}...)
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 return string(b)
463 }
464
465
466 func (mr *mr_IN) FmtDateLong(t time.Time) string {
467
468 b := make([]byte, 0, 32)
469
470 b = strconv.AppendInt(b, int64(t.Day()), 10)
471 b = append(b, []byte{0x20}...)
472 b = append(b, mr.monthsWide[t.Month()]...)
473 b = append(b, []byte{0x2c, 0x20}...)
474
475 if t.Year() > 0 {
476 b = strconv.AppendInt(b, int64(t.Year()), 10)
477 } else {
478 b = strconv.AppendInt(b, int64(-t.Year()), 10)
479 }
480
481 return string(b)
482 }
483
484
485 func (mr *mr_IN) FmtDateFull(t time.Time) string {
486
487 b := make([]byte, 0, 32)
488
489 b = append(b, mr.daysWide[t.Weekday()]...)
490 b = append(b, []byte{0x2c, 0x20}...)
491 b = strconv.AppendInt(b, int64(t.Day()), 10)
492 b = append(b, []byte{0x20}...)
493 b = append(b, mr.monthsWide[t.Month()]...)
494 b = append(b, []byte{0x2c, 0x20}...)
495
496 if t.Year() > 0 {
497 b = strconv.AppendInt(b, int64(t.Year()), 10)
498 } else {
499 b = strconv.AppendInt(b, int64(-t.Year()), 10)
500 }
501
502 return string(b)
503 }
504
505
506 func (mr *mr_IN) FmtTimeShort(t time.Time) string {
507
508 b := make([]byte, 0, 32)
509
510 h := t.Hour()
511
512 if h > 12 {
513 h -= 12
514 }
515
516 b = strconv.AppendInt(b, int64(h), 10)
517 b = append(b, mr.timeSeparator...)
518
519 if t.Minute() < 10 {
520 b = append(b, '0')
521 }
522
523 b = strconv.AppendInt(b, int64(t.Minute()), 10)
524 b = append(b, []byte{0x20}...)
525
526 if t.Hour() < 12 {
527 b = append(b, mr.periodsAbbreviated[0]...)
528 } else {
529 b = append(b, mr.periodsAbbreviated[1]...)
530 }
531
532 return string(b)
533 }
534
535
536 func (mr *mr_IN) FmtTimeMedium(t time.Time) string {
537
538 b := make([]byte, 0, 32)
539
540 h := t.Hour()
541
542 if h > 12 {
543 h -= 12
544 }
545
546 b = strconv.AppendInt(b, int64(h), 10)
547 b = append(b, mr.timeSeparator...)
548
549 if t.Minute() < 10 {
550 b = append(b, '0')
551 }
552
553 b = strconv.AppendInt(b, int64(t.Minute()), 10)
554 b = append(b, mr.timeSeparator...)
555
556 if t.Second() < 10 {
557 b = append(b, '0')
558 }
559
560 b = strconv.AppendInt(b, int64(t.Second()), 10)
561 b = append(b, []byte{0x20}...)
562
563 if t.Hour() < 12 {
564 b = append(b, mr.periodsAbbreviated[0]...)
565 } else {
566 b = append(b, mr.periodsAbbreviated[1]...)
567 }
568
569 return string(b)
570 }
571
572
573 func (mr *mr_IN) FmtTimeLong(t time.Time) string {
574
575 b := make([]byte, 0, 32)
576
577 h := t.Hour()
578
579 if h > 12 {
580 h -= 12
581 }
582
583 b = strconv.AppendInt(b, int64(h), 10)
584 b = append(b, mr.timeSeparator...)
585
586 if t.Minute() < 10 {
587 b = append(b, '0')
588 }
589
590 b = strconv.AppendInt(b, int64(t.Minute()), 10)
591 b = append(b, mr.timeSeparator...)
592
593 if t.Second() < 10 {
594 b = append(b, '0')
595 }
596
597 b = strconv.AppendInt(b, int64(t.Second()), 10)
598 b = append(b, []byte{0x20}...)
599
600 if t.Hour() < 12 {
601 b = append(b, mr.periodsAbbreviated[0]...)
602 } else {
603 b = append(b, mr.periodsAbbreviated[1]...)
604 }
605
606 b = append(b, []byte{0x20}...)
607
608 tz, _ := t.Zone()
609 b = append(b, tz...)
610
611 return string(b)
612 }
613
614
615 func (mr *mr_IN) FmtTimeFull(t time.Time) string {
616
617 b := make([]byte, 0, 32)
618
619 h := t.Hour()
620
621 if h > 12 {
622 h -= 12
623 }
624
625 b = strconv.AppendInt(b, int64(h), 10)
626 b = append(b, mr.timeSeparator...)
627
628 if t.Minute() < 10 {
629 b = append(b, '0')
630 }
631
632 b = strconv.AppendInt(b, int64(t.Minute()), 10)
633 b = append(b, mr.timeSeparator...)
634
635 if t.Second() < 10 {
636 b = append(b, '0')
637 }
638
639 b = strconv.AppendInt(b, int64(t.Second()), 10)
640 b = append(b, []byte{0x20}...)
641
642 if t.Hour() < 12 {
643 b = append(b, mr.periodsAbbreviated[0]...)
644 } else {
645 b = append(b, mr.periodsAbbreviated[1]...)
646 }
647
648 b = append(b, []byte{0x20}...)
649
650 tz, _ := t.Zone()
651
652 if btz, ok := mr.timezones[tz]; ok {
653 b = append(b, btz...)
654 } else {
655 b = append(b, tz...)
656 }
657
658 return string(b)
659 }
660
View as plain text