3

Cypress has the moment library imported into its API and can be accessed by Cypress.moment(date) https://docs.cypress.io/api/utilities/moment.html#Syntax

But I need to use moment-timezone instead of moment in the test to use switch between timezones. Previously (cypress@4.10) it worked following:

// cypress/support/index.js
Cypress.moment = require('moment-timezone');

But since the upgrade to cypress@4.12 I'm getting following error:

TS2339: Property 'tz' does not exist on type '{ (...args: any[]): any; momentProperties: any[]; suppressDeprecationWarnings: boolean; deprecationHandler: any; parseTwoDigitYear(input: any): number; createFromInputFallback: any; ISO_8601(): void; ... 34 more ...; HTML5_FMT: { ...; }; }'
MCFreddie777
  • 1,069
  • 1
  • 12
  • 21

0 Answers0