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(rc): Fix Version update time parsing failure #1089

Merged
merged 2 commits into from
Nov 13, 2020

Conversation

lahirumaramba
Copy link
Member

  • Current check for update time fails for timestamps with more than 3 milliseconds places. Updated the timestamp validation logic as a quick fix.

Resolves: #1088

@lahirumaramba lahirumaramba added the release:stage Stage a release candidate label Nov 13, 2020
@lahirumaramba
Copy link
Member Author

  • Tested with both 3 and 6 milliseconds places in timestamps (updated unit tests)
  • Added release:stage to trigger integration tests

@@ -394,4 +390,8 @@ class VersionImpl implements Version {
updateTime: this.updateTime,
}
}

private isValidTimestamp(timestamp: string): boolean {
return validator.isNonEmptyString(timestamp) && (new Date(timestamp)).getTime() > 0;
Copy link
Member Author

Choose a reason for hiding this comment

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

This validation fails for timestamps before January 1, 1970 and considers strings such as "1.2" as valid timestamps. I think that would be okay for this particular scenario. Open to suggestions!

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

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

Looks good. I'd recommend adding another test case for getTemplate() so that both old and new date formats get tested.

@lahirumaramba lahirumaramba merged commit 2781eff into master Nov 13, 2020
@lahirumaramba lahirumaramba deleted the lm-rc-fix-updatetime branch November 13, 2020 21:07
BorntraegerMarc pushed a commit to BorntraegerMarc/firebase-admin-node that referenced this pull request Jan 28, 2021
* fix(rc): Fix Version update time parsing failure

* Add test cases for 3 and 6 ms places
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:stage Stage a release candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

firebase remote config get template api fails throws "Version update time must be a valid date string"
2 participants