Skip to content

The result of dateparse.ParseFormat() function to infer timestamp is confusing #8

@xueyuncheng

Description

@xueyuncheng

When I use the dateparse.ParseFormat() function to process the timestamp, I expect it to return error, but instead of returning an error, it returns the layout as the timestamp itself, which seems very confusing. Maybe returning an error would be more appropriate?

func main() {
	layout, err := dateparse.ParseFormat("1744709364")
	if err != nil {
		fmt.Println(err)
		return
	}

	// output: 1744709364
	fmt.Println(layout)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions