Skip to content

toEighteen(id) ​

Convert a 15-digit ID number to 18 digits.

Signature ​

typescript
function toEighteen(id: string): string | null

Parameters ​

ParameterTypeDescription
idstring15-digit ID number

Returns ​

Returns the converted 18-digit ID number. Returns null if the input is not a valid 15-digit ID.

Live Demo ​

Example ​

typescript
import { toEighteen } from 'china-id-card'

toEighteen('110101900101001')  // → '110101199001010018'

基于 GB 11643-1999 标准