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.Duration > 24 hours not working as expected #2004

Closed
nielskrijger opened this issue Oct 2, 2024 · 1 comment
Closed

time.Duration > 24 hours not working as expected #2004

nielskrijger opened this issue Oct 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@nielskrijger
Copy link

Description

time.Duration > 24 hours is formatted differently than time.Duration < 24.

Steps to reproduce the issue:

  1. See playground: https://go.dev/play/p/NNpUJCVFju8

Describe the results you received:

A1 is as expected (duration < 24 hours):

Screenshot 2024-10-02 at 09 45 50

A2 is not usable (duration > 24 hours):

Screenshot 2024-10-02 at 09 45 53

Describe the results you expected:

A2 containing 24:51:44 (or anything equivalent in Excel that works as a duration).

In our use case we select the column and have Excel "Sum" the durations to a total. This works fine if the individual cells are formatted as 21:33:55 as long as each individual value doesn't go beyond 24 hours. Any value beyond 24 hours breaks this.

Output of go version:

go1.22.3 darwin/amd64

Excelize version or commit ID:

v2.8.1

Environment details (OS, Microsoft Excel™ version, physical, etc.):

Mac OS. Excel Version 16.89.1 (24091630).

@xuri xuri added the enhancement New feature or request label Oct 10, 2024
@xuri xuri moved this to Features in Excelize v2.9.0 Oct 10, 2024
@xuri xuri closed this as completed in f1d1a5d Oct 10, 2024
@xuri
Copy link
Member

xuri commented Oct 10, 2024

Thanks for your issue. I have added support for applying number format for time and duration cell value. Please upgrade the master branch code by go get -u github.com/xuri/excelize/v2@master, and this feature will be released in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Features
Development

No branches or pull requests

2 participants