monday icon indicating copy to clipboard operation
monday copied to clipboard

Refactor/chinese taiwan language

Open boonsanti opened this issue 6 years ago • 3 comments

boonsanti avatar May 18 '19 07:05 boonsanti

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?

goodsign avatar May 18 '19 08:05 goodsign

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?

mikejamesli avatar Jul 01 '20 12:07 mikejamesli

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!

goodsign avatar Jul 02 '20 11:07 goodsign