# Full DateTime in Checkout Validation Function

**URL:** <https://community.shopify.dev/t/full-datetime-in-checkout-validation-function/4317>\
**Category:** Functions\
**Tags:** cart-validation\
**Created:** [December 14, 2024, 9:41pm UTC](https://community.shopify.dev/t/full-datetime-in-checkout-validation-function/4317 "2024-12-14T21:41:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AppDev2023](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/appdev2023/32/404_2.png) [@AppDev2023](https://community.shopify.dev/u/AppDev2023)\
**Post date:** [December 14, 2024, 9:41pm UTC](https://community.shopify.dev/t/full-datetime-in-checkout-validation-function/4317/1 "2024-12-14T21:41:01Z")

</div>

shopify/wasm will give unix time of 0 when attempting to get the date

```ts
let d = new Date(); // 1970-01-01T00:00:00

```

So instead, Shopify has a suite of tools to check the date / local time

so, I can check if a time is before, after, or between an expected time … down the the second.

BUT, there is no function to simply pass the full date-time into the function input. the best is:

```graphql
{shop {localTime {date }}}

```

Note it is date (not dateTime) From the docs:

```auto
Date	
Represents an ISO 8601-encoded date string. For example, September 7, 2019 is represented as "2019-07-16".

```

I can check the day, but not the hour or second. To check with seconds-level granularity, we have to:

- use an external api to check the time?!
- repeatedly check if the time is between some range?!

**Solution:**  
Please add \* dateTime \* to the graphql schema for the localTime object.

---

<div class="post-metadata">

**Author:** ![AppDev2023](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/appdev2023/32/404_2.png) [@AppDev2023](https://community.shopify.dev/u/AppDev2023)\
**Post date:** [December 14, 2024, 9:43pm UTC](https://community.shopify.dev/t/full-datetime-in-checkout-validation-function/4317/2 "2024-12-14T21:43:55Z")

</div>

link docs since the forum didn’t allow these on my post, I have to do this

shopify.dev/docs/api/functions/reference/cart-checkout-validation/graphql/common-objects/localtime

---

<div class="post-metadata">

**Author:** ![JordanFinners](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/jordanfinners/32/6616_2.png) [@JordanFinners](https://community.shopify.dev/u/JordanFinners)\
**Post date:** [December 15, 2024, 10:11pm UTC](https://community.shopify.dev/t/full-datetime-in-checkout-validation-function/4317/3 "2024-12-15T22:11:56Z")

</div>

Hey, there are methods on the shop.localTime you can do to check if before/after, would that work?

> **[LocalTime](https://shopify.dev/docs/api/functions/reference/cart-checkout-validation/graphql/common-objects/localtime)**
>
> Represents limited information about the current time relative to the parent object.
