Replace date-fns with luxon
Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "4.0.0-alpha.45",
|
||||
"@octokit/rest": "^18.0.12",
|
||||
"date-fns": "^2.19.0",
|
||||
"luxon": "^1.26.0",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-router": "6.0.0-beta.0",
|
||||
"react-use": "^15.3.3",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { format } from 'date-fns';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
import { GhGetReleaseResponse } from '../../types/types';
|
||||
import {
|
||||
@@ -22,9 +22,15 @@ import {
|
||||
} from '../../test-helpers/test-helpers';
|
||||
import { getRcGitHubInfo } from './getRcGitHubInfo';
|
||||
|
||||
const injectedDate = format(1611869955783, 'yyyy.MM.dd');
|
||||
|
||||
describe('getRcGitHubInfo', () => {
|
||||
describe('DateTime', () => {
|
||||
it('should format dates as expected', () => {
|
||||
const formattedDate = DateTime.now().toFormat('yyyy.MM.dd');
|
||||
|
||||
expect(formattedDate).toMatch(/^\d{4}.\d{2}.\d{2}$/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('calver', () => {
|
||||
const latestRelease = {
|
||||
tag_name: 'rc-2020.01.01_0',
|
||||
@@ -36,7 +42,7 @@ describe('getRcGitHubInfo', () => {
|
||||
project: mockCalverProject,
|
||||
latestRelease,
|
||||
semverBumpLevel: 'minor',
|
||||
injectedDate,
|
||||
injectedDate: '2021.01.28',
|
||||
}),
|
||||
).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { format } from 'date-fns';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
import { getBumpedSemverTagParts } from '../../helpers/getBumpedTag';
|
||||
import { getSemverTagParts } from '../../helpers/tagParts/getSemverTagParts';
|
||||
@@ -24,7 +24,7 @@ export const getRcGitHubInfo = ({
|
||||
project,
|
||||
latestRelease,
|
||||
semverBumpLevel,
|
||||
injectedDate = format(new Date(), 'yyyy.MM.dd'), // '0012-01-01T13:37:00.000Z'
|
||||
injectedDate = DateTime.now().toFormat('yyyy.MM.dd'),
|
||||
}: {
|
||||
project: Project;
|
||||
latestRelease: GhGetReleaseResponse | null;
|
||||
|
||||
@@ -11408,11 +11408,6 @@ date-fns@^2.0.0-alpha.27, date-fns@^2.16.1:
|
||||
resolved "https://registry.npmjs.org/date-fns/-/date-fns-2.18.0.tgz#08e50aee300ad0d2c5e054e3f0d10d8f9cdfe09e"
|
||||
integrity sha512-NYyAg4wRmGVU4miKq5ivRACOODdZRY3q5WLmOJSq8djyzftYphU7dTHLcEtLqEvfqMKQ0jVv91P4BAwIjsXIcw==
|
||||
|
||||
date-fns@^2.19.0:
|
||||
version "2.19.0"
|
||||
resolved "https://artifactory.spotify.net/artifactory/api/npm/virtual-npm/date-fns/-/date-fns-2.19.0.tgz#65193348635a28d5d916c43ec7ce6fbd145059e1"
|
||||
integrity sha1-ZRkzSGNaKNXZFsQ+x85vvRRQWeE=
|
||||
|
||||
dateformat@^3.0.0:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
|
||||
|
||||
Reference in New Issue
Block a user