本文整理汇总了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);
});
开发者ID:scottohara,项目名称:loot,代码行数:7,代码来源:index.ts
示例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)
});
}
}
开发者ID:scottohara,项目名称:loot,代码行数:8,代码来源:schedules.ts
示例3: beforeEach
beforeEach((): void => {
transaction = {
transaction_type: "Basic",
next_due_date: startOfDay(new Date()),
autoFlag: false
};
scheduleEditController = controllerTest("ScheduleEditController", {schedule: null}) as ScheduleEditController;
});
开发者ID:scottohara,项目名称:loot,代码行数:8,代码来源:edit.ts
示例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" : ""
});
}
}
开发者ID:scottohara,项目名称:loot,代码行数:11,代码来源:transactionbatch.ts
示例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())
};
}
开发者ID:scottohara,项目名称:loot,代码行数:47,代码来源:transaction.ts
示例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;
}
开发者ID:scottohara,项目名称:loot,代码行数:7,代码来源:schedule.ts
示例7: beforeEach
beforeEach((): ScheduledTransaction => (schedule = scheduleModel["stringify"](createScheduledBasicTransaction({next_due_date: startOfDay(new Date())}))));
开发者ID:scottohara,项目名称:loot,代码行数:1,代码来源:schedule.ts
示例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()));
});
开发者ID:scottohara,项目名称:loot,代码行数:4,代码来源:schedule.ts
示例9: beforeEach
beforeEach((): Transaction => (transaction = transactionModel["stringify"](createBasicTransaction({transaction_date: startOfDay(new Date())}))));
开发者ID:scottohara,项目名称:loot,代码行数:1,代码来源:transaction.ts
示例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()));
});
开发者ID:scottohara,项目名称:loot,代码行数:4,代码来源:transaction.ts
注:本文中的date-fns/esm.startOfDay函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论