diff --git a/styles.go b/styles.go index 183211b..e32fb78 100644 --- a/styles.go +++ b/styles.go @@ -981,22 +981,33 @@ func parseTime(v string, format string) string { {"D", "2"}, {"yyyy", "2006"}, {"yy", "06"}, + {"MMMM", "%%%%"}, {"mmmm", "%%%%"}, + {"DDDD", "&&&&"}, {"dddd", "&&&&"}, + {"DD", "02"}, {"dd", "02"}, + {"D", "2"}, {"d", "2"}, + {"MMM", "Jan"}, {"mmm", "Jan"}, + {"MMSS", "0405"}, {"mmss", "0405"}, + {"SS", "05"}, {"ss", "05"}, {"s", "5"}, + {"MM:", "04:"}, {"mm:", "04:"}, + {":MM", ":04"}, {":mm", ":04"}, {"m:", "4:"}, {":m", ":4"}, + {"MM", "01"}, {"mm", "01"}, - {"am/pm", "pm"}, + {"AM/PM", "PM"}, + {"am/pm", "PM"}, + {"M/", "1/"}, {"m/", "1/"}, - {"m", "1"}, {"%%%%", "January"}, {"&&&&", "Monday"}, } diff --git a/styles_test.go b/styles_test.go index 9129914..19092af 100644 --- a/styles_test.go +++ b/styles_test.go @@ -307,6 +307,7 @@ func TestParseTime(t *testing.T) { assert.Equal(t, "3/4/2019 5:5:42", parseTime("43528.2123", "M/D/YYYY h:m:s")) assert.Equal(t, "3/4/2019 0:5:42", parseTime("43528.003958333335", "m/d/yyyy h:m:s")) assert.Equal(t, "3/4/2019 0:05:42", parseTime("43528.003958333335", "M/D/YYYY h:mm:s")) + assert.Equal(t, "3:30:00 PM", parseTime("0.64583333333333337", "h:mm:ss am/pm")) assert.Equal(t, "0:05", parseTime("43528.003958333335", "h:mm")) assert.Equal(t, "0:0", parseTime("6.9444444444444444E-5", "h:m")) assert.Equal(t, "0:00", parseTime("6.9444444444444444E-5", "h:mm"))