> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daily.co/llms.txt
> Use this file to discover all available pages before exploring further.

# useRoomExp

> Returns the automatic ejection date for the local participant, based on room or token configuration properties eject_after_elapsed, eject_at_room_exp and exp.

`useRoomExp(params?): Object`

The ejection date is derived from room or token configuration: [`eject_after_elapsed`](/reference/rest-api/rooms/get-room#body-properties-eject-after-elapsed), [`eject_at_room_exp`](/reference/rest-api/rooms/get-room#body-properties-eject-at-room-exp), and [`exp`](/reference/rest-api/rooms/get-room#response-config-exp). The optional `onCountdown` callback fires every second with the remaining `hours`, `minutes`, and `seconds`.

## Parameters (optional)

<ParamField body="onCountdown" type="Function">
  When `onCountdown` is set and the room is configured to eject the local participant at a given time, `onCountdown` will be called every second with an object parameter with keys `hours`, `minutes` and `seconds`.
</ParamField>

## Return value

An object with the following properties:

<ResponseField name="ejectDate" type="Date | null">
  The date when the local participant will be automatically ejected from the meeting.
</ResponseField>

```json theme={null}
{
  "ejectDate": "Wed Jul 26 2023 09:48:42 GMT+0200 (Central European Summer Time)"
}
```

## Example

```jsx theme={null}
import { useRoomExp } from '@daily-co/daily-react';
import { useCallback, useState } from 'react';

export const UseRoomExpDemo = () => {
  const [countdown, setCountdown] = useState('');
  const { ejectDate } = useRoomExp({
    onCountdown: useCallback(({ hours, minutes, seconds }) => {
      if (hours > 0) return;
      setCountdown(`${minutes}:${seconds.toString().padStart(2, '0')}`);
    }, []),
  });

  return (
    <div>
      Meeting ends in {countdown} (at {ejectDate.toISOString()})
    </div>
  );
};
```

## See also

<CardGroup>
  <Card title="daily-js methods" icon="code" iconType="solid">
    * [room()](/reference/daily-js/instance-methods/room)
  </Card>

  <Card title="REST APIs" icon="server" iconType="solid">
    * [Get room (eject\_after\_elapsed)](/reference/rest-api/rooms/get-room#body-properties-eject-after-elapsed)
    * [Get room (eject\_at\_room\_exp)](/reference/rest-api/rooms/get-room#body-properties-eject-at-room-exp)
    * [Meeting tokens (exp)](/reference/rest-api/meeting-tokens/create-meeting-token#body-properties-exp)
  </Card>
</CardGroup>
