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

Fix time format #666

Closed
wants to merge 3 commits into from
Closed

Conversation

yasar-luo
Copy link
Contributor

@yasar-luo yasar-luo commented Sep 7, 2018

This is:

  • a bugfix
  • a new feature

Checklist:

Why this change is needed?

relate issue #664
fix time format for duration is incorrect, when use format [h]:mm it should convert to the "total hours:minutes"

@patrickomeara
Copy link

Nice work @GreatHumorist

I think this will also fix @ivankruchkoff's issue #446 and @garrettgjb's issue #342 as the time format is no longer being stripped by the color preg_replace

@yasar-luo
Copy link
Contributor Author

@patrickomeara this is because the color strip code make [h] be stripped, and the time format default replace h as G in date format, which G represent the 24h format in a day, but which you want is the total hours, in excel, the [h] will default convert it to the total hours, but the PhpSpreadsheet have not achieved.

Copy link
Member

@PowerKiKi PowerKiKi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the test data I see quite a few missing cases. Most notably for colors, and also for elapsed periods as mentioned here: https://support.office.com/en-us/article/format-numbers-as-dates-or-times-418bd3fe-0577-47c8-8caa-b4d30c528309.

Would you mind adding those ?

@patrickomeara
Copy link

I can add some test cases.

@GreatHumorist are you able to resolve the conflicts via rebase or merge first?

@PowerKiKi
Copy link
Member

@patrickomeara feel free to open a new PR based on this one if @GreatHumorist does not reply

@stale
Copy link

stale bot commented Dec 20, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@stale stale bot added the stale label Dec 20, 2018
@stale stale bot closed this Dec 27, 2018
@PowerKiKi PowerKiKi reopened this Dec 30, 2018
@stale stale bot removed the stale label Dec 30, 2018
@PowerKiKi
Copy link
Member

I ended up adding a few cases myself and merged. Thanks !

@PowerKiKi PowerKiKi closed this in 699da09 Jan 2, 2019
guillaume-ro-fr pushed a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this pull request Jun 12, 2019
When using format `[h]:mm` it should convert to the "total hours:minutes"

Closes PHPOffice#666
Fixes PHPOffice#664
Fixes PHPOffice#446
Fixes PHPOffice#342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants