commands: Improve jekyll import date format
authorAnthony Kong <kongakong@users.noreply.github.com>
Mon, 13 Mar 2017 11:50:57 +0000 (22:50 +1100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 13 Mar 2017 11:50:57 +0000 (12:50 +0100)
Allow both yyyy-mm-dd and yyyy-m-d formats in jekyll markdown
file names.

commands/import_jekyll.go

index c33b68f2ed7d79f34e664de967e4a1269e02e6d0..071257d7d3d5cd7a98e7cdb9bc3e7a2c7968ec7e 100644 (file)
@@ -372,7 +372,7 @@ func parseJekyllFilename(filename string) (time.Time, string, error) {
                return time.Now(), "", errors.New("filename not match")
        }
 
-       postDate, err := time.Parse("2006-01-02", r[0][1])
+       postDate, err := time.Parse("2006-1-2", r[0][1])
        if err != nil {
                return time.Now(), "", err
        }