MCPcopy
hub / github.com/zgsm-ai/costrict / getNowPt

Function getNowPt

apps/web-roo-code/src/lib/blog/time.ts:12–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 * Returns date as YYYY-MM-DD and minutes since midnight
11 */
12export function getNowPt(): NowPt {
13 const formatter = new Intl.DateTimeFormat("en-US", {
14 timeZone: "America/Los_Angeles",
15 year: "numeric",
16 month: "2-digit",
17 day: "2-digit",
18 hour: "2-digit",
19 minute: "2-digit",
20 hour12: false,
21 })
22
23 const parts = formatter.formatToParts(new Date())
24 const get = (type: string) => parts.find((p) => p.type === type)?.value ?? ""
25
26 const date = `${get("year")}-${get("month")}-${get("day")}`
27 const minutes = parseInt(get("hour"), 10) * 60 + parseInt(get("minute"), 10)
28
29 return { date, minutes }
30}
31
32/**
33 * Parse publish_time_pt string to minutes since midnight

Callers 2

getAllBlogPostsFunction · 0.90
getBlogPostBySlugFunction · 0.90

Calls 2

parseIntFunction · 0.85
getFunction · 0.70

Tested by

no test coverage detected