javascript - 使用 dayjs 获取 beforeDate
问题描述
我们如何使用 DayJs 获取当前日期之前的日期。
我知道如何获取当前日期,但我们可以从当前日期删除 15 天吗?
cy.get('input[name="day"]').should('have.value', (Cypress.dayjs().format('DD')))
cy.get('input[name="month"]').should('have.value', (Cypress.dayjs().format('MM')))
cy.get('input[name="year"]').should('have.value', (Cypress.dayjs().format('YY'))) ```
This is my code for getting the currentDate. I would like to get 15 days before my current Date. I would have used substract if the date was one input field but here we have different placeholders for the inputs.
解决方案
推荐阅读
- node.js - 我可以使用带有 create-react-app 的自定义 node_modules 路径吗
- ios - Xcode 12 上传错误 ITMS-90085:“二进制文件中没有架构。Lipo 未能检测到捆绑可执行文件中的任何架构。”
- android - Android:使用 Gson 解析非常大的复杂 JSON
- python - 从 tweepy API 下载全文
- crystal-reports - 无法在没有夸大值或重复详细信息行的情况下汇总结果
- java - 带有 HashMap 的装饰器设计模式返回空 HashMap
- java - Java-一旦我的程序以第一个值运行后,如何输入新的输入?
- javascript - 如何在 React.js 中手动关闭 react-bootstrap “DropdownButton”
- python - 在pandas datafrane的字符串列中的特定数字之间添加特定字符?
- excel - VBA - 需要解析第二列并固定到底部,但卡住了