Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xranx OpenContext IOS Idea Time Format

From Leeroopedia
Knowledge Sources
Domains Date_Formatting, iOS
Last Updated 2026-10-24 00:00 GMT

Overview

Date and time formatting utilities for the iOS ideas timeline, providing date key generation, relative time display, and i18n-aware date formatting.

Description

The ideaTime.js module in src-ios/utils/ provides three date formatting functions used throughout the iOS ideas screen. formatDateKey converts a date to YYYY-MM-DD format. formatDateDisplay shows "Today", "Yesterday", or a locale-aware short date. formatRelativeTime shows "Just now", "X minutes ago", "X hours ago", or falls back to date display. All functions accept a translation function t for i18n support.

Usage

Import these functions in IdeasScreen.js and related components to format idea entry timestamps consistently.

Code Reference

Source Location

Signature

function formatDateKey(date) // → string ("YYYY-MM-DD")
function formatDateDisplay(dateKey, t) // → string
function formatRelativeTime(dateStr, t) // → string

Import

const { formatDateKey, formatDateDisplay, formatRelativeTime } = require('./utils/ideaTime');

I/O Contract

Inputs

Name Type Required Description
date string Yes Date object or ISO string
dateKey string Yes Pre-formatted "YYYY-MM-DD" string
dateStr string Yes ISO timestamp string
t Function Yes i18n translation function

Outputs

Name Type Description
formatDateKey string "YYYY-MM-DD" format, or "" on invalid date
formatDateDisplay string "Today", "Yesterday", or locale short date
formatRelativeTime string "Just now", "X min ago", "X hr ago", or date

Usage Examples

Formatting Entry Timestamps

const { formatRelativeTime, formatDateKey, formatDateDisplay } = require('./utils/ideaTime');
const { useTranslation } = require('react-i18next');

function EntryMeta({ entry }) {
  const { t } = useTranslation();
  return (
    <View>
      <Text>{formatRelativeTime(entry.created_at, t)}</Text>
      <Text>{formatDateDisplay(formatDateKey(entry.created_at), t)}</Text>
    </View>
  );
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment