forked from free-lancers/electricity_bill_calc_service
		
	fix(types):现在日期和时间的指针形式解析不在对空白字符串报错了。
This commit is contained in:
		@@ -59,7 +59,7 @@ func ParseDate(t string) (Date, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func ParseDatep(t string) (*Date, error) {
 | 
					func ParseDatep(t string) (*Date, error) {
 | 
				
			||||||
	if len(t) == 0 {
 | 
						if len(t) == 0 {
 | 
				
			||||||
		return nil, fmt.Errorf("不能解析空白的日期时间。")
 | 
							return nil, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, layout := range dateLayouts {
 | 
						for _, layout := range dateLayouts {
 | 
				
			||||||
		d, err := time.ParseInLocation(layout, t, loc)
 | 
							d, err := time.ParseInLocation(layout, t, loc)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -81,7 +81,7 @@ func ParseDateTime(t string) (DateTime, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func ParseDateTimep(t string) (*DateTime, error) {
 | 
					func ParseDateTimep(t string) (*DateTime, error) {
 | 
				
			||||||
	if len(t) == 0 {
 | 
						if len(t) == 0 {
 | 
				
			||||||
		return nil, fmt.Errorf("不能解析空白的日期时间。")
 | 
							return nil, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, layout := range datetimeLayouts {
 | 
						for _, layout := range datetimeLayouts {
 | 
				
			||||||
		fmt.Printf("Parse: %s, Try layout: %s\n", t, layout)
 | 
							fmt.Printf("Parse: %s, Try layout: %s\n", t, layout)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user