Refactor/chinese taiwan language
Hey @boonsanti
Thank you for your request! Can you please add/run some unit tests for this in the https://github.com/goodsign/monday/blob/master/monday_test.go file?
Hey @boonsanti @goodsign @boyzfunhouse
I am also looking for th_TH support, so I checked the unit tests @boonsanti added which look fine on the surface:
{LocaleThTH, time.Date(2013, 9, 3, 0, 0, 0, 0, time.UTC), "Mon Jan 2 2006", "อ ก.ย. 3 2013"},
The tests fail due to a mismatch in length for the return array of stringToLayoutItems:
func commonFormatFunc(value, format string, knownDaysShort, knownDaysLong,
knownMonthsShort, knownMonthsLong, knownPeriods map[string]string) (res string) {
l := stringToLayoutItems(value)
f := stringToLayoutItems(format)
if len(l) != len(f) {
return value // layouts does not matches
}
l returns 9 whereas f returns 7. This is because the period characters '.' in ก.ย. are being treated as separate items when this month short format should be treated as one item.
Any ideas on how to fix this?
Hey @mikejamesli
Thank you for finding this, I'm unavailable at the moment, unfortunately, but I should be able to find time to accept a PR, so can someone please check this?
Thanks!