Search Storyblok's Documentation
  1. Operation: lt_date

Operation: lt_date

Allows filtering Date/Time fields (Format: YYYY-mm-dd HH:MM). Returns all stories with a field value lower (i.e., earlier) than the provided value.

Examples Use Cases

  • filter_query[scheduled][gt_date]=2023-12-31 09:00

    Returns all stories with a date before the 31st of December, 2023, in their scheduled field.

  • Example Request and Response

    The following example demonstrates how to receive all stories with a date before the 31st of December, 2023, in their scheduled field using the lt_date operation.

    Request
    curl "https://api.storyblok.com/v2/cdn/stories/?filter_query[scheduled][lt_date]=2023-12-31 09:00&token=ask9soUkv02QqbZgmZdeDAtt" \
      -X GET \
      -H "Accept: application/json" \
      -H "Content-Type: application/json"
    Request
    // Using the Universal JavaScript Client:
    // https://github.com/storyblok/storyblok-js-client
    Storyblok.get('cdn/stories/', {
      "filter_query": {
        "scheduled": {
          "lt_date": "2023-12-31 09:00"
        }
      }
    })
      .then(response => {
        console.log(response)
      }).catch(error => { 
        console.log(error)
      })
    Request
    $client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
    
    $client->getStories([
      "filter_query" =>  [
        "scheduled" =>  [
          "lt_date" =>  "2023-12-31 09 => 00"
        ]
      ]
    ])->getBody();
    Request
    require 'storyblok'
    client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
    
    client.stories({:params => {
      "filter_query" =>  {
        "scheduled" =>  {
          "lt_date" =>  "2023-12-31 09 => 00"
        }
      }
    }})
    Request
    HttpResponse<String> response = Unirest.get("https://api.storyblok.com/v2/cdn/stories/?filter_query[scheduled][lt_date]=2023-12-31 09:00&token=ask9soUkv02QqbZgmZdeDAtt")
      .asString();
    Request
    var client = new RestClient("https://api.storyblok.com/v2/cdn/stories/?filter_query[scheduled][lt_date]=2023-12-31 09:00&token=ask9soUkv02QqbZgmZdeDAtt");
    var request = new RestRequest(Method.GET);
    
    IRestResponse response = client.Execute(request);
    Request
    import Foundation
    
    let request = NSMutableURLRequest(url: NSURL(string: "https://api.storyblok.com/v2/cdn/stories/?filter_query[scheduled][lt_date]=2023-12-31 09:00&token=ask9soUkv02QqbZgmZdeDAtt")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
    request.method = "GET"
    
    let session = URLSession.shared
    let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
      if (error != nil) {
        print(error)
      } else {
        let httpResponse = response as? HTTPURLResponse
        print(httpResponse)
      }
    })
    
    dataTask.resume()
    Request
    import requests
    
    url = "https://api.storyblok.com/v2/cdn/stories/"
    
    querystring = {"filter_query":{"scheduled":{"lt_date":"2023-12-31 09:00"}},"token":"ask9soUkv02QqbZgmZdeDAtt"}
    
    payload = ""
    headers = {}
    
    response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
    
    print(response.text)
    Response
    {
      "stories": [
        {
          "name": "Earth's Symphony: Navigating the Wonders and Challenges of Our Blue Oasis",
          "created_at": "2024-02-16T14:22:09.108Z",
          "published_at": "2024-03-07T16:13:58.747Z",
          "id": 444996765,
          "uuid": "660452d2-1a68-4493-b5b6-2f03b6fa722b",
          "content": {
            "_uid": "6bdf037c-f713-415c-a26a-8a9cfc926c85",
            "image": {
              "id": 14114772,
              "alt": "",
              "name": "",
              "focus": "",
              "title": "",
              "source": "",
              "filename": "https://a.storyblok.com/f/276232/2560x1946/ee938cf736/earth.jpg",
              "copyright": "",
              "fieldtype": "asset",
              "meta_data": {},
              "is_private": "",
              "is_external_url": false
            },
            "author": "e7307a9e-a3c5-47ad-8f6c-a1a36fe528e2",
            "topics": ["solar-system"],
            "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
            "headline": "Earth's Symphony: Navigating the Wonders and Challenges of Our Blue Oasis",
            "component": "article",
            "scheduled": "2023-10-01 15:00",
            "categories": ["45d968b6-5790-4fbb-aa41-5781b8edde51", "d8e48716-0ecf-4059-b568-343bf54e4128"],
            "highlighted": false
          },
          "slug": "earths-symphony-navigating-wonders-challenges-blue-oasis",
          "full_slug": "articles/earths-symphony-navigating-wonders-challenges-blue-oasis",
          "sort_by_date": null,
          "position": 0,
          "tag_list": [],
          "is_startpage": false,
          "parent_id": 444991588,
          "meta_data": null,
          "group_id": "8d99d18d-5c97-42cd-a646-51e0c553f26a",
          "first_published_at": "2024-02-16T14:30:11.990Z",
          "release_id": null,
          "lang": "default",
          "path": null,
          "alternates": [],
          "default_full_slug": null,
          "translated_slugs": null
        }
      ],
      "cv": 1709828038,
      "rels": [],
      "links": []
    }