---
name: "updateUserLimitTime"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "updateUserLimitTime - Update user validity period."
summary: "Update user validity period."
---

## updateUserLimitTime

> [VERSION] @ray-js/lock-sdk >= 1.0.0

### Description

Update user validity, permanent flag, and offline unlock restrictions.

### Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `userId` | `string` | Yes | User ID |
| `lockUserId` | `number` | Yes | Device-side user index |
| `permanent` | `boolean` | Yes | Whether permanently valid |
| `effective` | `EffectiveConfig` | No | Validity period configuration |
| `offlineUnlock` | `boolean` | No | Whether offline unlocking is allowed |

### Return Value

Type: `Promise<void>`

None

### Error Codes

| Error Code | Error Message |
| --- | --- |
| `1014` | The device does not support this feature |
| `1069` | No permission to modify member validity (non-admin) |
| `1049` | Modifying admin validity is not supported |
| `1032` | Validity configuration missing when not permanent |
| `1033` | Validity start date not configured |
| `1034` | Validity end date not configured |
| `1010` | Start time cannot be later than end time |
| `1035` | weeks not configured for weekly repetition |
| `1011` | Failed to update member validity on the device |
| `1012` | Failed to update member validity in the cloud |

### Referenced Types

##### `interface` EffectiveConfig

| Property | Type | Description |
| --- | --- | --- |
| `effectiveDate` | `number` | Effective date (seconds-level timestamp) |
| `expiredDate` | `number` | Expiration date (seconds-level timestamp) |
| `repeat` | `"none" \| "week"` | Repeat policy: none or weekly |
| `weeks` | `[0 \| 1, 0 \| 1, 0 \| 1, 0 \| 1, 0 \| 1, 0 \| 1, 0 \| 1]` | Weekly repeat bitmap |
| `effectiveTime` | `number` | Daily start time (minutes) |
| `expiredTime` | `number` | Daily end time (minutes) |

##### `type` Week

Weekly repeat bitmap: indices 0–6 correspond to Sun–Sat; 0 inactive, 1 active

```typescript
export type Week = [
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
];
```

##### `type` BitStatus

Bit switch: 0 off, 1 on / Single-bit flag

```typescript
export type BitStatus = 0 | 1;
```


### Examples

#### Example

```ts
import { updateUserLimitTime } from '@ray-js/lock-sdk';
await updateUserLimitTime({ userId: 'user_001', lockUserId: 1, permanent: true });
```
