add "yyyy-MM-dd HH:mm:ss" string format > time.Time
I notice that the Hugo use this project to convert the string to time.Time. When I migrate to Hugo from Hexo (another static blog generator). The Hugo said : > page.go:750: Failed to parse date '2016-03-06 15:28:01' in page xxxxx.md Hope you can merge this Pull request, so that those people who migrate to Hugo from Hexo are easy to use Hugo to generate the static blog. Thanks.
This commit is contained in:
		
							parent
							
								
									2580bc98dc
								
							
						
					
					
						commit
						2cd6d56eeb
					
				@ -212,3 +212,10 @@ func TestToDuration(t *testing.T) {
 | 
				
			|||||||
		assert.Equal(t, v.expected, ToDuration(v.input))
 | 
							assert.Equal(t, v.expected, ToDuration(v.input))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestStringToDate(t *testing.T) {
 | 
				
			||||||
 | 
						d := "2016-03-06 15:28:01"
 | 
				
			||||||
 | 
						format := "2006-01-02 15:04:05"
 | 
				
			||||||
 | 
						v, _ := time.Parse(format, d)
 | 
				
			||||||
 | 
						assert.Equal(t, ToTime(d), v)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user