Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time parse error #1093

Closed
hotfireeagle opened this issue Dec 10, 2021 · 9 comments
Closed

time parse error #1093

hotfireeagle opened this issue Dec 10, 2021 · 9 comments
Labels
duplicate This issue or pull request already exists

Comments

@hotfireeagle
Copy link

the excel data:

image

after parse, the output is:

image

the code is:

image

@danielbprice
Copy link

(I am not a maintainer here, but): did you try running from the top of the tree, i.e. from master? Because other time parsing bugs have been fixed since the most recent release. I recently hit #1080 which isn't that different.

@hotfireeagle
Copy link
Author

my excelize version is v2.4.2

@xuri
Copy link
Member

xuri commented Dec 11, 2021

This issue is duplicated with #764, #1030, #1070 and #1073 please upgrade to the master branch code, and this patch will be released in the next version v2.5.0:

go get -u github.com/xuri/excelize/v2@master
go mod tidy

@xuri xuri added the duplicate This issue or pull request already exists label Dec 11, 2021
@skytodmoon
Copy link

@xuri @danielbprice Have you resolved this problem? I met same after:
go get -u github.com/xuri/excelize/v2@master
go mod tidy
version:v2.4.2-0.20211219053624-6051434bf898

@xuri
Copy link
Member

xuri commented Dec 20, 2021

This issue has been fixed. Could you provide spreadsheet attachment and standalone code to reproduce this issue?

@skytodmoon
Copy link

skytodmoon commented Dec 20, 2021

@xuri

ENV:
MAC Big Sur 11.4
WPS 3.7.0
go mod:
`go 1.16

require (
github.com/xuri/excelize/v2 v2.4.2-0.20211219053624-6051434bf898
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect
golang.org/x/text v0.3.7 // indirect
)`

attachments: test.xlsx

func main() {
	f, err := excelize.OpenFile("test.xlsx")
	if err != nil {
		fmt.Println(err)
		return
	}
	defer func() {
		// Close the spreadsheet.
		if err := f.Close(); err != nil {
			fmt.Println(err)
		}
	}()
	// Get value from cell by given worksheet name and axis.
	cell, err := f.GetCellValue("Sheet1", "B2")
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(cell)
	// Get all the rows in the Sheet1.
	rows, err := f.GetRows("Sheet1")
	if err != nil {
		fmt.Println(err)
		return
	}
	for _, row := range rows {
		for _, colCell := range row {
			//fmt.Print(colCell, "\t")
			fmt.Printf("%s\n",colCell)
		}
		fmt.Println()
	}
}

result:

'12-17-21

12-18-21

12-19-21

12-20-21

12-21-21

12-22-21
'

@xuri
Copy link
Member

xuri commented Dec 20, 2021

The file attachments upload failed.

@skytodmoon
Copy link

@xuri uploaded.

@xuri
Copy link
Member

xuri commented Dec 20, 2021

This patch fixed the accuracy issue on parsing cells with time number format in some cases, but not related to language location. The library support parsing build-in date and time number format under English (United States) currently, so the cell value should be concat with a dash (not slash) after applying the number format, I'll consider adding language location support later.

xuri added a commit that referenced this issue Feb 12, 2022
- Introduced NFP (number format parser) dependencies module
- Initialize custom dates and times number format support
- Dependencies module upgraded
xuri added a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
…is improve number format support

- Introduced NFP (number format parser) dependencies module
- Initialize custom dates and times number format support
- Dependencies module upgraded
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
…is improve number format support

- Introduced NFP (number format parser) dependencies module
- Initialize custom dates and times number format support
- Dependencies module upgraded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants