...

Source file src/github.com/go-playground/locales/jmc/jmc.go

Documentation: github.com/go-playground/locales/jmc

     1  package jmc
     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 jmc 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  	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  // New returns a new instance of translator for the 'jmc' locale
    43  func New() locales.Translator {
    44  	return &jmc{
    45  		locale:             "jmc",
    46  		pluralsCardinal:    []locales.PluralRule{2, 6},
    47  		pluralsOrdinal:     nil,
    48  		pluralsRange:       nil,
    49  		timeSeparator:      ":",
    50  		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", "TSh", "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"},
    51  		monthsAbbreviated:  []string{"", "Jan", "Feb", "Mac", "Apr", "Mei", "Jun", "Jul", "Ago", "Sep", "Okt", "Nov", "Des"},
    52  		monthsNarrow:       []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
    53  		monthsWide:         []string{"", "Januari", "Februari", "Machi", "Aprilyi", "Mei", "Junyi", "Julyai", "Agusti", "Septemba", "Oktoba", "Novemba", "Desemba"},
    54  		daysAbbreviated:    []string{"Jpi", "Jtt", "Jnn", "Jtn", "Alh", "Iju", "Jmo"},
    55  		daysNarrow:         []string{"J", "J", "J", "J", "A", "I", "J"},
    56  		daysWide:           []string{"Jumapilyi", "Jumatatuu", "Jumanne", "Jumatanu", "Alhamisi", "Ijumaa", "Jumamosi"},
    57  		periodsAbbreviated: []string{"utuko", "kyiukonyi"},
    58  		periodsWide:        []string{"utuko", "kyiukonyi"},
    59  		erasAbbreviated:    []string{"KK", "BK"},
    60  		erasNarrow:         []string{"", ""},
    61  		erasWide:           []string{"Kabla ya Kristu", "Baada ya Kristu"},
    62  		timezones:          map[string]string{"ACDT": "ACDT", "ACST": "ACST", "ACWDT": "ACWDT", "ACWST": "ACWST", "ADT": "ADT", "AEDT": "AEDT", "AEST": "AEST", "AKDT": "AKDT", "AKST": "AKST", "ARST": "ARST", "ART": "ART", "AST": "AST", "AWDT": "AWDT", "AWST": "AWST", "BOT": "BOT", "BT": "BT", "CAT": "CAT", "CDT": "CDT", "CHADT": "CHADT", "CHAST": "CHAST", "CLST": "CLST", "CLT": "CLT", "COST": "COST", "COT": "COT", "CST": "CST", "ChST": "ChST", "EAT": "EAT", "ECT": "ECT", "EDT": "EDT", "EST": "EST", "GFT": "GFT", "GMT": "GMT", "GST": "GST", "GYT": "GYT", "HADT": "HADT", "HAST": "HAST", "HAT": "HAT", "HECU": "HECU", "HEEG": "HEEG", "HENOMX": "HENOMX", "HEOG": "HEOG", "HEPM": "HEPM", "HEPMX": "HEPMX", "HKST": "HKST", "HKT": "HKT", "HNCU": "HNCU", "HNEG": "HNEG", "HNNOMX": "HNNOMX", "HNOG": "HNOG", "HNPM": "HNPM", "HNPMX": "HNPMX", "HNT": "HNT", "IST": "IST", "JDT": "JDT", "JST": "JST", "LHDT": "LHDT", "LHST": "LHST", "MDT": "MDT", "MESZ": "MESZ", "MEZ": "MEZ", "MST": "MST", "MYT": "MYT", "NZDT": "NZDT", "NZST": "NZST", "OESZ": "OESZ", "OEZ": "OEZ", "PDT": "PDT", "PST": "PST", "SAST": "SAST", "SGT": "SGT", "SRT": "SRT", "TMST": "TMST", "TMT": "TMT", "UYST": "UYST", "UYT": "UYT", "VET": "VET", "WARST": "WARST", "WART": "WART", "WAST": "WAST", "WAT": "WAT", "WESZ": "WESZ", "WEZ": "WEZ", "WIB": "WIB", "WIT": "WIT", "WITA": "WITA", "∅∅∅": "∅∅∅"},
    63  	}
    64  }
    65  
    66  // Locale returns the current translators string locale
    67  func (jmc *jmc) Locale() string {
    68  	return jmc.locale
    69  }
    70  
    71  // PluralsCardinal returns the list of cardinal plural rules associated with 'jmc'
    72  func (jmc *jmc) PluralsCardinal() []locales.PluralRule {
    73  	return jmc.pluralsCardinal
    74  }
    75  
    76  // PluralsOrdinal returns the list of ordinal plural rules associated with 'jmc'
    77  func (jmc *jmc) PluralsOrdinal() []locales.PluralRule {
    78  	return jmc.pluralsOrdinal
    79  }
    80  
    81  // PluralsRange returns the list of range plural rules associated with 'jmc'
    82  func (jmc *jmc) PluralsRange() []locales.PluralRule {
    83  	return jmc.pluralsRange
    84  }
    85  
    86  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'jmc'
    87  func (jmc *jmc) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    88  
    89  	n := math.Abs(num)
    90  
    91  	if n == 1 {
    92  		return locales.PluralRuleOne
    93  	}
    94  
    95  	return locales.PluralRuleOther
    96  }
    97  
    98  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'jmc'
    99  func (jmc *jmc) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   100  	return locales.PluralRuleUnknown
   101  }
   102  
   103  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'jmc'
   104  func (jmc *jmc) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   105  	return locales.PluralRuleUnknown
   106  }
   107  
   108  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   109  func (jmc *jmc) MonthAbbreviated(month time.Month) string {
   110  	return jmc.monthsAbbreviated[month]
   111  }
   112  
   113  // MonthsAbbreviated returns the locales abbreviated months
   114  func (jmc *jmc) MonthsAbbreviated() []string {
   115  	return jmc.monthsAbbreviated[1:]
   116  }
   117  
   118  // MonthNarrow returns the locales narrow month given the 'month' provided
   119  func (jmc *jmc) MonthNarrow(month time.Month) string {
   120  	return jmc.monthsNarrow[month]
   121  }
   122  
   123  // MonthsNarrow returns the locales narrow months
   124  func (jmc *jmc) MonthsNarrow() []string {
   125  	return jmc.monthsNarrow[1:]
   126  }
   127  
   128  // MonthWide returns the locales wide month given the 'month' provided
   129  func (jmc *jmc) MonthWide(month time.Month) string {
   130  	return jmc.monthsWide[month]
   131  }
   132  
   133  // MonthsWide returns the locales wide months
   134  func (jmc *jmc) MonthsWide() []string {
   135  	return jmc.monthsWide[1:]
   136  }
   137  
   138  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   139  func (jmc *jmc) WeekdayAbbreviated(weekday time.Weekday) string {
   140  	return jmc.daysAbbreviated[weekday]
   141  }
   142  
   143  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   144  func (jmc *jmc) WeekdaysAbbreviated() []string {
   145  	return jmc.daysAbbreviated
   146  }
   147  
   148  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   149  func (jmc *jmc) WeekdayNarrow(weekday time.Weekday) string {
   150  	return jmc.daysNarrow[weekday]
   151  }
   152  
   153  // WeekdaysNarrow returns the locales narrow weekdays
   154  func (jmc *jmc) WeekdaysNarrow() []string {
   155  	return jmc.daysNarrow
   156  }
   157  
   158  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   159  func (jmc *jmc) WeekdayShort(weekday time.Weekday) string {
   160  	return jmc.daysShort[weekday]
   161  }
   162  
   163  // WeekdaysShort returns the locales short weekdays
   164  func (jmc *jmc) WeekdaysShort() []string {
   165  	return jmc.daysShort
   166  }
   167  
   168  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   169  func (jmc *jmc) WeekdayWide(weekday time.Weekday) string {
   170  	return jmc.daysWide[weekday]
   171  }
   172  
   173  // WeekdaysWide returns the locales wide weekdays
   174  func (jmc *jmc) WeekdaysWide() []string {
   175  	return jmc.daysWide
   176  }
   177  
   178  // Decimal returns the decimal point of number
   179  func (jmc *jmc) Decimal() string {
   180  	return jmc.decimal
   181  }
   182  
   183  // Group returns the group of number
   184  func (jmc *jmc) Group() string {
   185  	return jmc.group
   186  }
   187  
   188  // Group returns the minus sign of number
   189  func (jmc *jmc) Minus() string {
   190  	return jmc.minus
   191  }
   192  
   193  // FmtNumber returns 'num' with digits/precision of 'v' for 'jmc' and handles both Whole and Real numbers based on 'v'
   194  func (jmc *jmc) FmtNumber(num float64, v uint64) string {
   195  
   196  	return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   197  }
   198  
   199  // FmtPercent returns 'num' with digits/precision of 'v' for 'jmc' and handles both Whole and Real numbers based on 'v'
   200  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   201  func (jmc *jmc) FmtPercent(num float64, v uint64) string {
   202  	return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   203  }
   204  
   205  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'jmc'
   206  func (jmc *jmc) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   207  
   208  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   209  	symbol := jmc.currencies[currency]
   210  	l := len(s) + len(symbol) + 0
   211  	count := 0
   212  	inWhole := v == 0
   213  	b := make([]byte, 0, l)
   214  
   215  	for i := len(s) - 1; i >= 0; i-- {
   216  
   217  		if s[i] == '.' {
   218  			b = append(b, jmc.decimal[0])
   219  			inWhole = true
   220  			continue
   221  		}
   222  
   223  		if inWhole {
   224  			if count == 3 {
   225  				b = append(b, jmc.group[0])
   226  				count = 1
   227  			} else {
   228  				count++
   229  			}
   230  		}
   231  
   232  		b = append(b, s[i])
   233  	}
   234  
   235  	for j := len(symbol) - 1; j >= 0; j-- {
   236  		b = append(b, symbol[j])
   237  	}
   238  
   239  	if num < 0 {
   240  		b = append(b, jmc.minus[0])
   241  	}
   242  
   243  	// reverse
   244  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   245  		b[i], b[j] = b[j], b[i]
   246  	}
   247  
   248  	if int(v) < 2 {
   249  
   250  		if v == 0 {
   251  			b = append(b, jmc.decimal...)
   252  		}
   253  
   254  		for i := 0; i < 2-int(v); i++ {
   255  			b = append(b, '0')
   256  		}
   257  	}
   258  
   259  	return string(b)
   260  }
   261  
   262  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'jmc'
   263  // in accounting notation.
   264  func (jmc *jmc) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   265  
   266  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   267  	symbol := jmc.currencies[currency]
   268  	l := len(s) + len(symbol) + 0
   269  	count := 0
   270  	inWhole := v == 0
   271  	b := make([]byte, 0, l)
   272  
   273  	for i := len(s) - 1; i >= 0; i-- {
   274  
   275  		if s[i] == '.' {
   276  			b = append(b, jmc.decimal[0])
   277  			inWhole = true
   278  			continue
   279  		}
   280  
   281  		if inWhole {
   282  			if count == 3 {
   283  				b = append(b, jmc.group[0])
   284  				count = 1
   285  			} else {
   286  				count++
   287  			}
   288  		}
   289  
   290  		b = append(b, s[i])
   291  	}
   292  
   293  	if num < 0 {
   294  
   295  		for j := len(symbol) - 1; j >= 0; j-- {
   296  			b = append(b, symbol[j])
   297  		}
   298  
   299  		b = append(b, jmc.minus[0])
   300  
   301  	} else {
   302  
   303  		for j := len(symbol) - 1; j >= 0; j-- {
   304  			b = append(b, symbol[j])
   305  		}
   306  
   307  	}
   308  
   309  	// reverse
   310  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   311  		b[i], b[j] = b[j], b[i]
   312  	}
   313  
   314  	if int(v) < 2 {
   315  
   316  		if v == 0 {
   317  			b = append(b, jmc.decimal...)
   318  		}
   319  
   320  		for i := 0; i < 2-int(v); i++ {
   321  			b = append(b, '0')
   322  		}
   323  	}
   324  
   325  	return string(b)
   326  }
   327  
   328  // FmtDateShort returns the short date representation of 't' for 'jmc'
   329  func (jmc *jmc) FmtDateShort(t time.Time) string {
   330  
   331  	b := make([]byte, 0, 32)
   332  
   333  	if t.Day() < 10 {
   334  		b = append(b, '0')
   335  	}
   336  
   337  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   338  	b = append(b, []byte{0x2f}...)
   339  
   340  	if t.Month() < 10 {
   341  		b = append(b, '0')
   342  	}
   343  
   344  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   345  
   346  	b = append(b, []byte{0x2f}...)
   347  
   348  	if t.Year() > 0 {
   349  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   350  	} else {
   351  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   352  	}
   353  
   354  	return string(b)
   355  }
   356  
   357  // FmtDateMedium returns the medium date representation of 't' for 'jmc'
   358  func (jmc *jmc) FmtDateMedium(t time.Time) string {
   359  
   360  	b := make([]byte, 0, 32)
   361  
   362  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   363  	b = append(b, []byte{0x20}...)
   364  	b = append(b, jmc.monthsAbbreviated[t.Month()]...)
   365  	b = append(b, []byte{0x20}...)
   366  
   367  	if t.Year() > 0 {
   368  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   369  	} else {
   370  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   371  	}
   372  
   373  	return string(b)
   374  }
   375  
   376  // FmtDateLong returns the long date representation of 't' for 'jmc'
   377  func (jmc *jmc) FmtDateLong(t time.Time) string {
   378  
   379  	b := make([]byte, 0, 32)
   380  
   381  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   382  	b = append(b, []byte{0x20}...)
   383  	b = append(b, jmc.monthsWide[t.Month()]...)
   384  	b = append(b, []byte{0x20}...)
   385  
   386  	if t.Year() > 0 {
   387  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   388  	} else {
   389  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   390  	}
   391  
   392  	return string(b)
   393  }
   394  
   395  // FmtDateFull returns the full date representation of 't' for 'jmc'
   396  func (jmc *jmc) FmtDateFull(t time.Time) string {
   397  
   398  	b := make([]byte, 0, 32)
   399  
   400  	b = append(b, jmc.daysWide[t.Weekday()]...)
   401  	b = append(b, []byte{0x2c, 0x20}...)
   402  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   403  	b = append(b, []byte{0x20}...)
   404  	b = append(b, jmc.monthsWide[t.Month()]...)
   405  	b = append(b, []byte{0x20}...)
   406  
   407  	if t.Year() > 0 {
   408  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   409  	} else {
   410  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   411  	}
   412  
   413  	return string(b)
   414  }
   415  
   416  // FmtTimeShort returns the short time representation of 't' for 'jmc'
   417  func (jmc *jmc) FmtTimeShort(t time.Time) string {
   418  
   419  	b := make([]byte, 0, 32)
   420  
   421  	if t.Hour() < 10 {
   422  		b = append(b, '0')
   423  	}
   424  
   425  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   426  	b = append(b, jmc.timeSeparator...)
   427  
   428  	if t.Minute() < 10 {
   429  		b = append(b, '0')
   430  	}
   431  
   432  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   433  
   434  	return string(b)
   435  }
   436  
   437  // FmtTimeMedium returns the medium time representation of 't' for 'jmc'
   438  func (jmc *jmc) FmtTimeMedium(t time.Time) string {
   439  
   440  	b := make([]byte, 0, 32)
   441  
   442  	if t.Hour() < 10 {
   443  		b = append(b, '0')
   444  	}
   445  
   446  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   447  	b = append(b, jmc.timeSeparator...)
   448  
   449  	if t.Minute() < 10 {
   450  		b = append(b, '0')
   451  	}
   452  
   453  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   454  	b = append(b, jmc.timeSeparator...)
   455  
   456  	if t.Second() < 10 {
   457  		b = append(b, '0')
   458  	}
   459  
   460  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   461  
   462  	return string(b)
   463  }
   464  
   465  // FmtTimeLong returns the long time representation of 't' for 'jmc'
   466  func (jmc *jmc) FmtTimeLong(t time.Time) string {
   467  
   468  	b := make([]byte, 0, 32)
   469  
   470  	if t.Hour() < 10 {
   471  		b = append(b, '0')
   472  	}
   473  
   474  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   475  	b = append(b, jmc.timeSeparator...)
   476  
   477  	if t.Minute() < 10 {
   478  		b = append(b, '0')
   479  	}
   480  
   481  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   482  	b = append(b, jmc.timeSeparator...)
   483  
   484  	if t.Second() < 10 {
   485  		b = append(b, '0')
   486  	}
   487  
   488  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   489  	b = append(b, []byte{0x20}...)
   490  
   491  	tz, _ := t.Zone()
   492  	b = append(b, tz...)
   493  
   494  	return string(b)
   495  }
   496  
   497  // FmtTimeFull returns the full time representation of 't' for 'jmc'
   498  func (jmc *jmc) FmtTimeFull(t time.Time) string {
   499  
   500  	b := make([]byte, 0, 32)
   501  
   502  	if t.Hour() < 10 {
   503  		b = append(b, '0')
   504  	}
   505  
   506  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   507  	b = append(b, jmc.timeSeparator...)
   508  
   509  	if t.Minute() < 10 {
   510  		b = append(b, '0')
   511  	}
   512  
   513  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   514  	b = append(b, jmc.timeSeparator...)
   515  
   516  	if t.Second() < 10 {
   517  		b = append(b, '0')
   518  	}
   519  
   520  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   521  	b = append(b, []byte{0x20}...)
   522  
   523  	tz, _ := t.Zone()
   524  
   525  	if btz, ok := jmc.timezones[tz]; ok {
   526  		b = append(b, btz...)
   527  	} else {
   528  		b = append(b, tz...)
   529  	}
   530  
   531  	return string(b)
   532  }
   533  

View as plain text