我想在每个启动时间中添加15分钟的插槽,然后存储在一系列对象中
const createTimeSlots=(fromTime,toTime)=>{
我想在循环中为每个启动时间添加15分钟的插槽,然后存储在一系列对象中。
const createTimeSlots=(fromTime,toTime)=>{
I want to add 15 minutes slot to each StartTime in a loop and store in array of objects.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设输入在时间戳中,则添加15分钟的时间戳,然后推动时间戳(或推动分钟/小时等)。这是启动时间是当前时间戳,末端时间是时间戳中的当前 + 3小时。
Assuming the inputs are in timestamp, add 15 mins equivalent of timestamps and push that timestamp(or push mins/hrs etc.). Here's the code example where start time is current timestamp and endtime is current + 3hrs in timestamp.
假设输入是有效的日期时间格式。
该解决方案将跨日期工作,假设您今天和明天结束时间的开始时间,那么它也可以无问题。
Let's assume inputs are valid date-time format.
This solution will work across dates, let's say you give the start time today and end time tomorrow then also it will work without any issue.