Home / Function/ getDateFromFile() — ui Function Reference

getDateFromFile() — ui Function Reference

Architecture documentation for the getDateFromFile() function in changelog.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  dc7487bf_b5eb_e86b_e6dd_c14d9aa4b9f5["getDateFromFile()"]
  799e6b2d_bd25_4cd9_2509_71888f55cc48["changelog.ts"]
  dc7487bf_b5eb_e86b_e6dd_c14d9aa4b9f5 -->|defined in| 799e6b2d_bd25_4cd9_2509_71888f55cc48
  915b7d17_403a_c6c7_23e4_6ce3baf3dabe["getChangelogPages()"]
  915b7d17_403a_c6c7_23e4_6ce3baf3dabe -->|calls| dc7487bf_b5eb_e86b_e6dd_c14d9aa4b9f5
  style dc7487bf_b5eb_e86b_e6dd_c14d9aa4b9f5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/lib/changelog.ts lines 17–34

export function getDateFromFile(slugs: string[]) {
  const filePath = path.join(
    process.cwd(),
    "content/docs",
    ...slugs.slice(0, -1),
    `${slugs[slugs.length - 1]}.mdx`
  )
  try {
    const content = fs.readFileSync(filePath, "utf-8")
    const { attributes } = fm<{ date?: string | Date }>(content)
    if (attributes.date) {
      return new Date(attributes.date)
    }
  } catch {
    // File not found or parse error.
  }
  return null
}

Subdomains

Frequently Asked Questions

What does getDateFromFile() do?
getDateFromFile() is a function in the ui codebase, defined in apps/v4/lib/changelog.ts.
Where is getDateFromFile() defined?
getDateFromFile() is defined in apps/v4/lib/changelog.ts at line 17.
What calls getDateFromFile()?
getDateFromFile() is called by 1 function(s): getChangelogPages.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free