# give/4.16.9/src/Admin/common/getRelativeTimeString.ts

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.9. 14 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.9/code/src/Admin/common/getRelativeTimeString.ts
- Raw: https://pluginprobe.com/plugins/give/4.16.9/raw/src/Admin/common/getRelativeTimeString.ts
- Modified: 2025-11-05T14:00:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.16.9/code/src/Admin/common/getRelativeTimeString.ts#L10-L20`.

```typescript
import {humanTimeDiff, getDate} from '@wordpress/date';

/**
 * Returns a relative time string for a given date (e.g. "Today" or "2 days ago")
 *
 * @since 4.13.0 updated to use the @wordpress/date functions
 * @since 4.10.0
 */
export function getRelativeTimeString(date: Date): string {
    const now = getDate(new Date().toISOString());

    return humanTimeDiff(date, now);
}

```
