Skip to content

Commit

Permalink
Replacing day.js with moment.js
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy committed Sep 5, 2023
1 parent 90853ac commit 92cffc0
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@

/// <reference types="cypress" />

import customParseFormat from 'dayjs/plugin/customParseFormat';
import dayjs from 'dayjs';
import moment from 'moment';
import { BASE_PATH } from '../../../utils/constants';

dayjs.extend(customParseFormat);

const delay = 100;
const GANTT_VIS_NAME =
'A test gantt chart ' + Math.random().toString(36).substring(2);
Expand Down Expand Up @@ -181,7 +178,9 @@ describe('Configure panel settings', () => {
.eq(0)
.invoke('text')
.then((text) => {
expect(dayjs(text, 'MM/DD hh:mm:ss A', true).isValid()).to.be.true;
expect(
moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A')
).equal(text);
});

cy.get('select').eq(3).select('MM/DD/YY hh:mm A');
Expand All @@ -192,7 +191,9 @@ describe('Configure panel settings', () => {
.eq(0)
.invoke('text')
.then((text) => {
expect(dayjs(text, 'MM/DD/YY hh:mm A', true).isValid()).to.be.true;
expect(
moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A')
).equal(text);
});

cy.get('select').eq(3).select('HH:mm:ss.SSS');
Expand All @@ -203,7 +204,9 @@ describe('Configure panel settings', () => {
.eq(0)
.invoke('text')
.then((text) => {
expect(dayjs(text, 'HH:mm:ss.SSS', true).isValid()).to.be.true;
expect(
moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A')
).equal(text);
});

cy.get('select').eq(3).select('MM/DD HH:mm:ss');
Expand All @@ -214,7 +217,9 @@ describe('Configure panel settings', () => {
.eq(0)
.invoke('text')
.then((text) => {
expect(dayjs(text, 'MM/DD HH:mm:ss', true).isValid()).to.be.true;
expect(
moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A')
).equal(text);
});

cy.get('select').eq(3).select('MM/DD/YY HH:mm');
Expand All @@ -225,7 +230,9 @@ describe('Configure panel settings', () => {
.eq(0)
.invoke('text')
.then((text) => {
expect(dayjs(text, 'MM/DD/YY HH:mm', true).isValid()).to.be.true;
expect(
moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A')
).equal(text);
});
});

Expand Down

0 comments on commit 92cffc0

Please sign in to comment.