diff --git a/default_formats.go b/default_formats.go index d257f22..fd6e190 100644 --- a/default_formats.go +++ b/default_formats.go @@ -131,6 +131,13 @@ const ( DefaultFormatNbNODateTime = "15:04 02.01.06" DefaultFormatNbNOTime = "15:04" + DefaultFormatPlPLFull = "Monday, 2 January 2006" // Polish (Poland) + DefaultFormatPlPLLong = "2 January 2006" + DefaultFormatPlPLMedium = "02 Jan 2006" + DefaultFormatPlPLShort = "02.01.2006" + DefaultFormatPlPLDateTime = "02.01.2006, 15:04" + DefaultFormatPlPLTime = "15:04" + DefaultFormatPtPTFull = "Monday, 2 de January de 2006" // Portuguese (Portugal) DefaultFormatPtPTLong = "2 de January de 2006" DefaultFormatPtPTMedium = "02/01/2006" diff --git a/format_pl_pl.go b/format_pl_pl.go index 034f1bc..359e48e 100644 --- a/format_pl_pl.go +++ b/format_pl_pl.go @@ -40,6 +40,21 @@ var longMonthNamesPlPL = map[string]string{ "December": "Grudzień", } +var longMonthNamesGenitivePlPL = map[string]string{ + "January": "stycznia", + "February": "lutego", + "March": "marca", + "April": "kwietnia", + "May": "maja", + "June": "czerwca", + "July": "lipca", + "August": "sierpnia", + "September": "września", + "October": "października", + "November": "listopada", + "December": "grudnia", +} + var shortMonthNamesPlPL = map[string]string{ "Jan": "Sty", "Feb": "Lut", @@ -54,3 +69,18 @@ var shortMonthNamesPlPL = map[string]string{ "Nov": "Lis", "Dec": "Gru", } + +var shortMonthNamesGenitivePlPL = map[string]string{ + "Jan": "sty", + "Feb": "lut", + "Mar": "mar", + "Apr": "kwi", + "May": "maj", + "Jun": "cze", + "Jul": "lip", + "Aug": "sie", + "Sep": "wrz", + "Oct": "paź", + "Nov": "lis", + "Dec": "gru", +} diff --git a/monday.go b/monday.go index 42564f0..15fa862 100644 --- a/monday.go +++ b/monday.go @@ -28,7 +28,7 @@ var internalFormatFuncs = map[Locale]internalFormatFunc{ LocaleItIT: createCommonFormatFunc(LocaleItIT), LocaleNnNO: createCommonFormatFunc(LocaleNnNO), LocaleNbNO: createCommonFormatFunc(LocaleNbNO), - LocalePlPL: createCommonFormatFunc(LocalePlPL), + LocalePlPL: createCommonFormatFuncWithGenitive(LocalePlPL), LocalePtPT: createCommonFormatFunc(LocalePtPT), LocalePtBR: createCommonFormatFunc(LocalePtBR), LocaleRoRO: createCommonFormatFunc(LocaleRoRO), @@ -80,7 +80,7 @@ var internalParseFuncs = map[Locale]internalParseFunc{ LocaleItIT: createCommonParseFunc(LocaleItIT), LocaleNnNO: createCommonParseFunc(LocaleNnNO), LocaleNbNO: createCommonParseFunc(LocaleNbNO), - LocalePlPL: parseFuncPtCommon(LocalePlPL), + LocalePlPL: createCommonParseFuncWithGenitive(LocalePlPL), LocalePtPT: parseFuncPtCommon(LocalePtPT), LocalePtBR: parseFuncPtCommon(LocalePtBR), LocaleRoRO: createCommonParseFunc(LocaleRoRO), @@ -248,6 +248,8 @@ func fillKnownWords() { fillKnownDaysShort(shortDayNamesPlPL, LocalePlPL) fillKnownMonthsLong(longMonthNamesPlPL, LocalePlPL) fillKnownMonthsShort(shortMonthNamesPlPL, LocalePlPL) + fillKnownMonthsGenitiveLong(longMonthNamesGenitivePlPL, LocalePlPL) + fillKnownMonthsGenitiveShort(shortMonthNamesGenitivePlPL, LocalePlPL) // Pt_PT: Portuguese (Portugal) fillKnownDaysLong(longDayNamesPtPT, LocalePtPT) diff --git a/monday_test.go b/monday_test.go index c2ab4e2..1d90e12 100644 --- a/monday_test.go +++ b/monday_test.go @@ -179,11 +179,11 @@ var formatTests = []FormatTest{ {LocalePlPL, time.Date(2013, 9, 3, 0, 0, 0, 0, time.UTC), "Mon Jan 2 2006", "Wto Wrz 3 2013"}, {LocalePlPL, time.Date(2013, 9, 4, 0, 0, 0, 0, time.UTC), "Monday Jan 2 2006", "Środa Wrz 4 2013"}, {LocalePlPL, time.Date(2013, 10, 3, 0, 0, 0, 0, time.UTC), "Monday January 02 2006", "Czwartek Październik 03 2013"}, - {LocalePlPL, time.Date(2013, 11, 3, 0, 0, 0, 0, time.UTC), "Monday. 2 January 2006", "Niedziela. 3 Listopad 2013"}, - {LocalePlPL, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006. 2 January. Monday", "2013. 13 Maj. Poniedziałek"}, - {LocalePlPL, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2 Jan 2006", "13 Maj 2013"}, + {LocalePlPL, time.Date(2013, 11, 3, 0, 0, 0, 0, time.UTC), "Monday. 2 January 2006", "Niedziela. 3 listopada 2013"}, + {LocalePlPL, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006. 2 January. Monday", "2013. 13 maja. Poniedziałek"}, + {LocalePlPL, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2 Jan 2006", "13 maj 2013"}, {LocalePlPL, time.Date(0, 5, 1, 0, 0, 0, 0, time.UTC), "January", "Maj"}, - {LocalePlPL, time.Date(0, 5, 13, 0, 0, 0, 0, time.UTC), "2 January", "13 Maj"}, + {LocalePlPL, time.Date(0, 5, 13, 0, 0, 0, 0, time.UTC), "2 January", "13 maja"}, {LocalePtPT, time.Date(2013, 9, 3, 0, 0, 0, 0, time.UTC), "Mon Jan 2 2006", "ter Set 3 2013"}, {LocalePtPT, time.Date(2013, 9, 4, 0, 0, 0, 0, time.UTC), "Monday Jan 2 2006", "Quarta-feira Set 4 2013"},