本文整理汇总了TypeScript中date-fns/esm.startOfDay函数的典型用法代码示例。如果您正苦于以下问题:TypeScript startOfDay函数的具体用法?TypeScript startOfDay怎么用?TypeScript startOfDay使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了startOfDay函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should resort the schedule list when the modal is closed", (): void => {
schedule.id = 999;
schedule.next_due_date = subDays(startOfDay(new Date()), 1);
scheduleIndexController["editSchedule"](1);
$uibModal.close({data: schedule});
(scheduleIndexController.schedules.pop() as ScheduledTransaction).should.deep.equal(schedule);
});
示例2: createScheduledBasicTransaction
function *schedules(count: number): Iterable<ScheduledBasicTransaction> {
for (let id = 1, daysAgo = count + 1; id < count + 1; id++, daysAgo--) {
yield createScheduledBasicTransaction({
id,
next_due_date: subDays(startOfDay(new Date()), daysAgo)
});
}
}
示例3: beforeEach
beforeEach((): void => {
transaction = {
transaction_type: "Basic",
next_due_date: startOfDay(new Date()),
autoFlag: false
};
scheduleEditController = controllerTest("ScheduleEditController", {schedule: null}) as ScheduleEditController;
});
示例4: createBasicTransaction
function *transactions(count: number): Iterable<BasicTransaction> {
for (let id = 1, daysAgo = count + 1; id < count + 1; id++, daysAgo--) {
yield createBasicTransaction({
id,
amount: id,
direction: id % 2 ? "outflow" : "inflow",
transaction_date: subDays(startOfDay(new Date()), daysAgo),
status: id < 5 ? "Cleared" : ""
});
}
}
示例5: constructor
public constructor(transactionMockProvider: TransactionMockProvider, transactionBatchMockProvider: TransactionBatchMockProvider, $qMockProvider: QMockProvider) {
// Success/error = options for the stub promises
const success: PromiseMockConfig<BasicTransaction> = {
args: {id: 1},
response: transactionMockProvider.$get()
},
error: PromiseMockConfig<void> = {
args: {id: -1}
},
$q: QMock = $qMockProvider.$get();
// Mock transactionModel object
this.transactionModel = {
all: $q.promisify({
args: "/1",
response: transactionBatchMockProvider.$get()
}, {
args: "/-1"
}),
query: $q.promisify({
args: "search",
response: transactionBatchMockProvider.$get()
}, {
args: "dontsearch"
}),
findSubtransactions: $q.promisify({
response: [
createSubtransferTransaction({id: 1}),
createSubtransaction({id: 2}),
createSubtransaction({id: 3})
]
}, {
args: -1
}),
find: $q.promisify({
response: transactionMockProvider.$get()
}),
save: $q.promisify(success, error),
destroy: $q.promisify(success, error),
updateStatus: $q.promisify(),
flag: $q.promisify(success, error),
unflag: $q.promisify(1, -1),
allDetailsShown: sinon.stub().returns(true),
showAllDetails: sinon.stub(),
lastTransactionDate: startOfDay(new Date())
};
}
示例6: parse
// Performs post-processing after parsing from JSON
private parse(schedule: ScheduledTransaction): ScheduledTransaction {
// Convert the next due date from a string ("YYYY-MM-DD") to a native JS date
schedule.next_due_date = startOfDay(schedule.next_due_date);
return schedule;
}
示例7: beforeEach
beforeEach((): ScheduledTransaction => (schedule = scheduleModel["stringify"](createScheduledBasicTransaction({next_due_date: startOfDay(new Date())}))));
示例8: it
it("should convert the next due date from a string to a date", (): void => {
schedule.next_due_date.should.be.a("date");
schedule.next_due_date.should.deep.equal(startOfDay(new Date()));
});
示例9: beforeEach
beforeEach((): Transaction => (transaction = transactionModel["stringify"](createBasicTransaction({transaction_date: startOfDay(new Date())}))));
示例10: it
it("should convert the transaction date from a string to a date", (): void => {
(transaction.transaction_date as Date).should.be.a("date");
(transaction.transaction_date as Date).should.deep.equal(startOfDay(new Date()));
});