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

update csv export to include full date and time in 12 hour format #5922

Merged
merged 2 commits into from Apr 15, 2024

Conversation

TChukwuleta
Copy link
Contributor

Resolves #5915

Copy link
Member

@Kukks Kukks left a comment

Choose a reason for hiding this comment

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

This is a breaking change so extra care should be considered. Maybe we need to see what the old export on the invoices page used to export first

@TChukwuleta
Copy link
Contributor Author

This is the csv export view prior to this requested change. In 24 hours format:

image

modifyFields(srv.result.fields, data, 'amount', displayValue)
modifyFields(srv.result.fields, data, 'datetime', v => v? moment(v).format('YYYY-MM-DD hh:mm:ss'): v);
modifyFields(srv.result.fields, data, 'datetime', v => v ? moment(v).format("dddd, MMMM Do YYYY, h:mm:ss a"): v);
Copy link
Member

Choose a reason for hiding this comment

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

To not break the curent format I'd suggest to simply use proper ISO format with added timezone info, like this:

Suggested change
modifyFields(srv.result.fields, data, 'datetime', v => v ? moment(v).format("dddd, MMMM Do YYYY, h:mm:ss a"): v);
modifyFields(srv.result.fields, data, 'datetime', v => v ? (new Date(v)).toISOString().replace('T', ' '));

Not sure if v is a Date already, if so it could be v.toISOString().

Copy link
Member

Choose a reason for hiding this comment

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

we shouldn't do string manipulations to format dates when we have a library to do things properly.

@NicolasDorier
Copy link
Member

@TChukwuleta I think you only have to change 'YYYY-MM-DD hh:mm:ss' to 'YYYY-MM-DD HH:mm:ss'. This format is making sure excel recognize the cells as date.

@TChukwuleta
Copy link
Contributor Author

TChukwuleta commented Apr 15, 2024

Yea. done that @NicolasDorier. Excel export now in 24 hour format

Thanks

@NicolasDorier NicolasDorier merged commit d2e95c2 into btcpayserver:master Apr 15, 2024
1 of 4 checks passed
NicolasDorier pushed a commit that referenced this pull request Apr 15, 2024
)

* update csv export to include full date and time in 12 hour format

* formatting the export datetime to 24 hours
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: On CSV export we do have 12h format but no indication of am/pm
4 participants