SmartBlocks icon indicating copy to clipboard operation
SmartBlocks copied to clipboard

A SmartBlock to get the current time rounded down to the nearest half-hour

Open aminbenselim opened this issue 5 years ago • 0 comments

✂️ Copy of your #42SmartBlock from Roam

  •   #42SmartBlock nw
    
    • <%JAVASCRIPT:```javascript
      return dayjs()
        .minute(dayjs().minute() > 29 ? 30 : 0)
        .format('HH:mm')```%> <%CURSOR%>
      

📋 Describe the SmartBlock

I write down my notes under the current timestamp. I however do not care about the current minute but do care about the time block it was created at (for me, each time block is 30 minutes)

This simple SmartBlock gets the current time and rounds it down to the nearest half-hour timestamp

For example: - 14:25 becomes 14:00 - 14:42 becomes 14:30

✅ Describe any prerequisites or dependencies that are required for this SmartBlock

None required

📷 Screenshot of your #42SmartBlock workflow/template from Roam

nw SmartBlock

💡 Additional Info

aminbenselim avatar Jan 09 '21 20:01 aminbenselim