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 Part of #8668: Add JsDocs to date-time-format file #10814

Merged

Conversation

linnhallonqvist
Copy link
Contributor

Overview

  1. This PR fixes or fixes part of All the Frontend services should be documented with jsdoc. #8668
  2. This PR does the following: Adding JsDocs to the file date-time-format.service.ts.

Essential Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The linter/Karma presubmit checks have passed locally on your machine.
  • "Allow edits from maintainers" is checked. (See here for instructions on how to enable it.)
    • This lets reviewers restart your CircleCI tests for you.
  • The PR is made from a branch that's not called "develop".

PR Pointers

  • Make sure to follow the instructions for making a code change.
  • Oppiabot will notify you when you don't add a PR_CHANGELOG label. If you are unable to do so, please @-mention a code owner (who will be in the Reviewers list), or ask on Gitter.
  • For what code owners will expect, see the Code Owner's wiki page.
  • Make sure your PR follows conventions in the style guide, otherwise this will lead to review delays.
  • Never force push. If you do, your PR will be closed.

@oppiabot
Copy link

oppiabot bot commented Sep 29, 2020

Assigning @bansalnitish for code owner reviews. Thanks!

@linnhallonqvist
Copy link
Contributor Author

Hi @bansalnitish , have you had time to look at this? Is it a problem that not all ci tests pass? I have trouble understanding why the tests fail.

Copy link
Contributor

@bansalnitish bansalnitish left a comment

Choose a reason for hiding this comment

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

Hi @linnhallonqvist, Took a pass!

@@ -45,17 +53,32 @@ export class DateTimeFormatService {
return moment(date).format('MM/DD/YY');
}
}
// Returns date along with time.
/**
* This function converts a millisecond date to a human-readable date
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please replace human-readable with the exact format like 'MMM D HH:mm A'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you please merge the latest develop with your branch once and see if the tests pass?

I have adressed your comments and merged developed with my branch. Hope it looks better! @bansalnitish

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// local datetime representation has the same year as the current date.
// Otherwise, returns the full date (with the year abbreviated).
/**
* This function returns just the time if the local datetime representation
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the word just. Also, can you frame it like The function returns X if Y. Else if A, it returns B. Else, it returns C?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

* if the local datetime representation has the same year as the current
* date. Otherwise, returns the full date (with the year abbreviated).
* @param {number} millisSinceEpoch - milliseconds since Epoch
* @returns {string} - The time if the local datetime representation has the
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto for this. Also, I would say adding the complete description once in the main function description. Here you could simply say returns a date or something.

We should not add the same description in the return as well as the function definiton.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

getLocaleDateTimeHourString(millisSinceEpoch: number): string {
let date = new Date(millisSinceEpoch);
return moment(date).format('MMM D HH:mm A');
}
// Returns just the date.
/**
* This function converts a millisecond date to a human-readable date.
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto for the human-readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@bansalnitish
Copy link
Contributor

Can you please merge the latest develop with your branch once and see if the tests pass?

@DubeySandeep
Copy link
Member

Hi @linnhallonqvist, Can you please reply to the open comments once its resolved? (Following the wiki guidelines)
image

Also, make sure to ping the reviewer once it's ready for review!

@DubeySandeep
Copy link
Member

@srijanreddy98, Can you please review this PR?

@linnhallonqvist
Copy link
Contributor Author

Hello @DubeySandeep ! Done, sorry for missing that. Also I'm not sure what is meant by "submit the review to add all your messages to the main thread"?

Copy link
Member

@srijanreddy98 srijanreddy98 left a comment

Choose a reason for hiding this comment

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

LGTM! -- thanks @linnhallonqvist.

@oppiabot
Copy link

oppiabot bot commented Oct 14, 2020

Unassigning @srijanreddy98 since they have already approved the PR.

@oppiabot oppiabot bot added the PR: LGTM label Oct 14, 2020
@srijanreddy98
Copy link
Member

@linnhallonqvist congrats on getting your first PR merged.

@srijanreddy98 srijanreddy98 merged commit 5229d2e into oppia:develop Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants