I have a string "products_2016-05-09" where 2016-05-09 is date appended in the string. I want to extract this date. If the date is minus 1 day I want to display string "products". How can I do this in liquid syntax?
Extracting string and comparing with date
936 views Asked by Deepika Rajani At
2
There are 2 answers
0
Deepika Rajani
On
The below code worked for me:
{% assign var = {{custom_attribute.${producttype}}} %}
{% assign words = var | split: '_' %}
{% assign yestDate = 'now' | date: "%s" | minus: 86400 | date: "%F" %}
{% assign varDate = words[1] %}
{% if varDate | convert: "date" == yestDate %}
Dynamic String {{words[0]}}
{% else %}
sorry!
{% endif %}
Related Questions in SHOPIFY
- Can I Customise The Order Table At Admin Side Of Partner.Shopify?
- Integrating OpenAI's ChatGPT with Shopify and Interakt Webhook for Improved Customer Support
- Remove specific products from cart on change in shopify
- Shopify theme edit to change bundles copy
- The Hamburgermenu of my shopify website (www.skiffaboei.myshopify.com) is not showing after clicking on the icon
- Integrating with Shopify to Retrieve Invoices as PDFs
- Shopify Flashlist re-render issue in android
- Shopify - Checkbox being unchecked during checkout
- Blogs Standard URL Filter /Tagged/Tag Not Working - Shopify
- Does Shopify Functions Work with Draft Orders? Unable to Disable Coupon Code Application
- How to send note attribute field in order data in Shopify liquid?
- After pointing Cpanel domain to Shopify, I am not able to either Receive or Send Emails
- Shopify reCaptcha V2 align to right cant select images or buttons
- In shopify set default product image size
- What CSP Headers are needed for serving .NET Core site to iframe in Shopify Page?
Related Questions in LIQUID
- Remove specific products from cart on change in shopify
- Blogs Standard URL Filter /Tagged/Tag Not Working - Shopify
- Liquid Template - How to map JSON object as a string to output field
- Eleventy site builder: Make JavaScript function available for Nunjucks templates
- Looker: Comparing Dynamic Dates with Liquid
- Liquibase 4.26 while importing the csv file it's taking long time
- Fill missing elements with previous one - Liquid, Shopify
- How to call a Cart Drawer in custom product section?
- Shopify Metafield List of Collections
- How would I close this space up on the right? Using Shopify liquid
- Unable to build dynamic iterative lists
- Resetting loop count on liquid on condition
- window.Shopify.settings is undefined. How do I access Shopify theme settings in JavaScript?
- How does Jekyll apply `include` outside of `<body>` tag?
- Checkout Page in Shopify
Related Questions in APPBOY
- When I add the import for mParticle_appboy I get a "No such Module" error
- Use Custom Event Properties for Canvas Decision Splits in Braze?
- RCTEventEmitter payload is null in React Na
- Install and add custom events of @braze/sdk-web package in sails js/node js
- How to display Appboy HTML inAppMessage in React JS app
- Has anyone successfully used Braze/Appboy with Nuxt.js?
- Rich notification not received when app is force quit
- Appboy SDK. How to hide visit indicator for News Feed cards?
- Android flavor and build variant specific appboy.xml file
- Appboy initialize handler
- Appboy iOS implementation
- Category function name collision, how do I specify which category to use?
- AppBoy iOS push notifications
- Extracting string and comparing with date
- Appboy-iOS-SDK/AppboyKit.h not found
Related Questions in BRAZE
- Received 'BadDeviceToken' (different push-token used by Braze than the one I send them)
- Deeplink problem when application working in the background (Braze provider), React Native, iOS
- Braze <> Snowflake Integration
- Cannot get Braze InApp Messages to show up in my appllication
- How to replicate a Braze Canvas Webhook in Salesforce Marketing Cloud
- How to Code Braze Web SDK Content Cards - Tutorial For Beginners
- Asset validation failed when distributing an app
- Braze send data to be displayed in campaign email
- Use Custom Event Properties for Canvas Decision Splits in Braze?
- RCTEventEmitter payload is null in React Na
- Install and add custom events of @braze/sdk-web package in sails js/node js
- How to display Appboy HTML inAppMessage in React JS app
- Has anyone successfully used Braze/Appboy with Nuxt.js?
- Braze canvas - unable to receive emails
- Rich notification not received when app is force quit
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
To extract the date from the
string, use theremoveandsplitfilters:To check if that product date (
pdate) is within 24 hours (86400 seconds) back, use something like this:Note: This only check if the product date is yesterday (24 hours ago from now) for a more accurate time verification, you need to do more arithmetics. You could also do all of this on the front-end using JavaScript.