Skip to content

Example Patch Release #3904

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"lint:css": "stylelint \"src/**/*.scss\" --syntax scss",
"prebuild:es": "npm-run-all copy:styles ts:defs copy:flow",
"release": "yarn release:beta",
"release:beta": "DIST=beta BRANCH=master ./scripts/release.sh",
"release:beta": "DIST=beta BRANCH=hotfix-v21.0.0 ./scripts/release.sh",
"release:hotfix": "DIST=latest HOTFIX=true ./scripts/release.sh",
"release:latest": "DIST=latest BRANCH=master ./scripts/release.sh",
"release:next": "DIST=next BRANCH=next ./scripts/release.sh",
Expand Down
7 changes: 2 additions & 5 deletions scripts/cut_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,8 @@ push_new_release() {
# Check untracked files
check_untracked_files || return 1

# Run the release
if ! HUSKY_SKIP_HOOKS=1 BRANCH=$BRANCH DIST=$DIST yarn semantic-release --no-ci; then
printf "${red}Failed semantic release!${end}"
return 1
fi
npm version 21.0.1 --no-git-tag-version
yarn prettier --write --parser=json package.json

# Get the latest version from uncommitted package.json
VERSION=$(./node_modules/@box/frontend/shell/version.sh)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`features/virtualized-table-renderers/lastModifiedByCellRenderer should render a LastModifiedByCell 1`] = `"4 years ago by 123-Rando-a@a.com"`;
exports[`features/virtualized-table-renderers/lastModifiedByCellRenderer should render a LastModifiedByCell 1`] = `"5 years ago by 123-Rando-a@a.com"`;
2 changes: 2 additions & 0 deletions src/utils/__tests__/uploads.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ describe('util/uploads', () => {
${{ lastModified: 'not a number' }} | ${null}
${{ lastModified: new Date('2017-01-02T03:04:05.678Z') }} | ${'2017-01-02T03:04:05Z'}
${{ lastModified: new Date('not valid') }} | ${null}
${{ lastModified: -11644473600 }} | ${null}
${{}} | ${null}
${{ lastModifiedDate: 1483326245678 }} | ${'2017-01-02T03:04:05Z'}
${{ lastModifiedDate: 'not a number' }} | ${null}
${{ lastModifiedDate: new Date('2017-01-02T03:04:05.678Z') }} | ${'2017-01-02T03:04:05Z'}
${{ lastModifiedDate: new Date('not valid') }} | ${null}
${{ lastModifiedDate: -11644473600 }} | ${null}
${{}} | ${null}
`(
'should return the properly formatted date when possible and return null otherwise',
Expand Down
24 changes: 17 additions & 7 deletions src/utils/uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,23 @@ function getFileLastModifiedAsISONoMSIfPossible(file: UploadFile): ?string {
// The compatibility chart at https://developer.mozilla.org/en-US/docs/Web/API/File/lastModified#Browser_compatibility
// is not up to date as of 12-13-2018. Edge & ie11 do not support lastModified, but support lastModifiedDate.
const lastModified = file.lastModified || file.lastModifiedDate;
if (
lastModified &&
(typeof lastModified === 'string' || typeof lastModified === 'number' || lastModified instanceof Date)
) {
const lastModifiedDate = new Date(lastModified);
if (isValidDateObject(lastModifiedDate)) {
return toISOStringNoMS(lastModifiedDate);
if (lastModified) {
let lastModifiedDate: Date | null = null;

if (typeof lastModified === 'number') {
// Only non-negative timestamps are valid. In rare cases, the timestamp may be erroneously set to a negative value
// https://issues.chromium.org/issues/393149335
if (lastModified < 0) {
return null;
}
lastModifiedDate = new Date(lastModified); // Try number first
} else if (typeof lastModified === 'string' || lastModified instanceof Date) {
lastModifiedDate = new Date(lastModified);
}

if (lastModifiedDate && isValidDateObject(lastModifiedDate)) {
const isoString = toISOStringNoMS(lastModifiedDate);
return isoString;
}
}

Expand Down
Loading