---
name: "up.fragment.time"
area: "API"
kind: "JavaScript function"
parent: "up.fragment module"
url: "https://unpoly.com/api/up.fragment.time"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.fragment module](https://unpoly.com/api/up.fragment.md)</nav>

# up.fragment.time(element)

Returns the last modification time of the content in the given element.

The last modification time corresponds to the [`Last-Modified`](https://unpoly.com/api/Last-Modified.md) header in the response that rendered the fragment. Alternatively the [`[up-time]`](https://unpoly.com/api/up-time.md) attribute of the element or an ancestor is used.

If no ancestor fragment with an [`[up-time]`](https://unpoly.com/api/up-time.md) attribute exists, `undefined` is returned.

When the fragment is reloaded, its modification time is sent as an [`If-Modified-Since`](https://unpoly.com/api/If-Modified-Since.md) request header. The server may check the header and decide to [skip rendering](https://unpoly.com/learn/conditional-requests.md).

<nav aria-label="Guides">

- [Learn: Conditional requests](https://unpoly.com/learn/conditional-requests.md)

</nav>

---

## Parameters {#parameters}

### element {#element}

(required)

Type: [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element)

---

## Return value {#return-value}

The fragment's last modification time.

Returns `undefined` if the fragment was rendered without a modification time.

Type: Date | undefined

