Moment.js: date getting null to be expect true/false

Viewed 26
const moment: any require('moment');

I want to replace require('moment') that's why I use import * as moment from 'moment'; Here I get error component.formControl.setValue(moment('05/02/2021 13:00', 'MM/DD/YYYY hh:mm')) for moment so to solve that I change component.formControl.setValue(moment().format('05/02/2021 13:00', 'MM/DD/YYYY hh:mm'))

But once I run my test case after this change getting error of "expect null to be true". Its complicated bit because if I use require('moment') then test case is successfully run, only issue if I import moment. But I dont want require('moment'). Please check image to be more specify example. Can anyone help to solve this issue. Thank You in advance.

enter image description here enter image description here

0 Answers
Related