...

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

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

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

View as plain text