We all have to write some bad code sometimes in order to make our code work. Similarly, I have to do that yesterday. I was getting the DateTime in yyyyMMddhhmmss format which is a very common format in Java. Now I need to convert that to a JavaScript Date for doing some computation on the dates.
This is where I have to write a bad code where I have to slice Year, Month, Day, Hour, Minutes and Seconds and then using the date class converted it into the JavaScript Date and then computed it with other dates as shown below
Date.UTC($entity.updated.slice(0, 4), $entity.updated.slice(4, 6) - 1, $entity.updated.slice(6, 8), $entity.updated.slice(8, 10), $entity.updated.slice(10, 12), $entity.updated.slice(12, 14)) >= Date.now().minusDays(7)
Though I tried to write a good code by writing it in a function, because of SnapLogic limitation, have to write this in ugly format.
tech debts, tech debts everywhere. :P
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
As a follower of @followforupvotes this post has been randomly selected and upvoted! Enjoy your upvote and have a great day!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations! This post has been upvoted from the communal account, @minnowsupport, by codingdefined from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.
If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi @codingdefined!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 5.108 which ranks you at #921 across all Steem accounts.
Your rank has dropped 2 places in the last three days (old rank 919).
In our last Algorithmic Curation Round, consisting of 304 contributions, your post is ranked at #181.
Evaluation of your UA score:
Feel free to join our @steem-ua Discord server
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit