Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在淘汰赛中获得过去的日期(比如昨天)。要获得当前日期,我写如下:
self.currentDate = ko.observable(new Date().toString('yyyy-M-dd'))
但是如何在这里获得昨天的日期?
没有使用 date.js 库进行测试,但也许这样的东西可以工作:
var yesterday = Date.today().addDays(-1); self.currentDate = ko.observable(yesterday.toString('yyyy-M-dd'));