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

Converting SP dates to readable excel date format #495

Merged
merged 6 commits into from
Aug 30, 2021
Merged

Converting SP dates to readable excel date format #495

merged 6 commits into from
Aug 30, 2021

Conversation

Rundez
Copy link
Contributor

@Rundez Rundez commented Aug 1, 2021

Your checklist for this pull request

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). Don't request your main!
  • Make sure you are making a pull request against the dev branch (left side). Also you should start your branch off dev.
  • Check the commit's or even all commits' message
  • Check if your code additions will fail linting checks
  • Remember: Add PR description to CHANGELOG with the ID that matches this PR

Description

When exporting project information with dates from "Porteføljeoversikt", the dates were not recognized by excel due to the format.
The solution: Convert the Sharepoint date format to a standard JS date object recognized by excel.

How to test

  • Navigate to "Porteføljeoversikt", add start and end date columns, then export to excel.
  • The dates should now be recognized by excel.

Relevant issues (if applicable)

fixes #487

💔Thank you!

@Rundez Rundez self-assigned this Aug 1, 2021
Copy link
Collaborator

@olemp olemp left a comment

Choose a reason for hiding this comment

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

Too hardcoded in my opinion. Only works for these two date fields. We should look into a more dynamic solution that works for all date fields, including custom ones.

@tarjeieo
Copy link
Member

tarjeieo commented Aug 2, 2021

Too hardcoded in my opinion. Only works for these two date fields. We should look into a more dynamic solution that works for all date fields, including custom ones.

I agree that it's not ideal. How about iterating over properties of the item, converting those ending with *OWSDATE to proper date values?

@olemp
Copy link
Collaborator

olemp commented Aug 2, 2021

Too hardcoded in my opinion. Only works for these two date fields. We should look into a more dynamic solution that works for all date fields, including custom ones.

I agree that it's not ideal. How about iterating over properties of the item, converting those ending with *OWSDATE to proper date values?

We should have access to the columns array, where we have the column config and can catch if it's a date.

@Rundez
Copy link
Contributor Author

Rundez commented Aug 4, 2021

I agree. Added a solution that iterates the columns and checks the field type. This should also convert any custom date values.

@olemp olemp self-requested a review August 9, 2021 07:38
@tarjeieo
Copy link
Member

Any input here @olemp ? Can this be merged?

@tarjeieo tarjeieo added this to the 1.2.9 milestone Aug 17, 2021
@olemp
Copy link
Collaborator

olemp commented Aug 17, 2021

Any input here @olemp ? Can this be merged?

Still want to have a look through it. Should have time this week - tomorrow or Thu.

@tarjeieo
Copy link
Member

Any input here @olemp ? Can this be merged?

Still want to have a look through it. Should have time this week - tomorrow or Thu.

Friendly reminder :)

Copy link
Collaborator

@olemp olemp left a comment

Choose a reason for hiding this comment

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

Se comments.

const items = isArray(selectedItems) && selectedItems.length > 0 ? selectedItems : fltItems

fltColumns.map((col) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Rundez You're using Array.map without returning anything. Seems like it's Array.forEach you want to use here.

@olemp
Copy link
Collaborator

olemp commented Aug 25, 2021

See Array.map documentation

@olemp olemp removed the request for review from tarjeieo August 27, 2021 11:02
@Rundez
Copy link
Contributor Author

Rundez commented Aug 27, 2021

@olemp Changed map to foreach.....

@olemp olemp merged commit 6b4c5f6 into dev Aug 30, 2021
@olemp olemp deleted the Issues/#487 branch August 30, 2021 06:49
@pzljanb pzljanb mentioned this pull request Sep 3, 2021
27 tasks
@danielwiese
Copy link

Tested OK

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.

4 participants