
Security News
Lovable’s OJ Rewrites Vite’s Dev Server in Rust as AI Lowers the Cost of Forking Open Source
Lovable’s OJ rewrites Vite’s dev server in Rust, reducing memory use and preview times as AI lowers the cost of open source reimplementation.
@blueprintlabio/time-ai
Advanced tools
Time-aware utilities for LLM applications - parse dates, add temporal context, and optimize prompts
Time-aware utilities for LLM applications - parse dates, add temporal context, and optimize prompts
npm install @blueprintlabio/time-ai
import { TimeAI } from '@blueprintlabio/time-ai';
const timeAI = new TimeAI({
timezone: 'America/New_York',
locale: 'en-US'
});
// Enhance prompts with temporal context
const result = timeAI.enhancePrompt("Schedule a meeting next Friday at 2pm");
console.log(result.enhancedText);
// "Schedule a meeting next Friday (2025-09-19) at 2pm"
// Add current date context to any prompt
const prompt = timeAI.addContext("What's the weather like?");
console.log(prompt);
// Current date: 2025-09-15 (Sunday, 2025)
// Timezone: America/New_York
//
// What's the weather like?
// Parse dates from natural language
const date = timeAI.parseDate("tomorrow at 3pm");
console.log(date?.resolvedDate);
// Date object for tomorrow at 3pm
new TimeAI(config?: TimeAIConfig)
Config Options:
timezone?: string - Target timezone (default: system timezone)locale?: string - Locale for formatting (default: system locale)strategy?: 'preserve' | 'normalize' | 'hybrid' - Date formatting strategy (default: 'hybrid')includeContext?: boolean - Whether to include temporal context (default: true)enhancePrompt(text: string, options?: { strategy?: 'preserve' | 'normalize' | 'hybrid' }): EnhancedPromptEnhance text with temporal context and date disambiguation.
const result = timeAI.enhancePrompt("Meet next Friday", { strategy: 'hybrid' });
// Returns: {
// originalText: "Meet next Friday",
// enhancedText: "Meet next Friday (2025-09-19)",
// context: "Current date: 2025-09-15...",
// extractions: [...],
// tokensAdded: 12
// }
Strategies:
preserve - Keep original date text unchangednormalize - Replace with absolute dates (YYYY-MM-DD)hybrid - Combine relative and absolute: "next Friday (2025-09-19)"parseDate(text: string): DateExtraction | nullParse the first date found in text.
const extraction = timeAI.parseDate("tomorrow at 3pm");
// Returns: {
// originalText: "tomorrow at 3pm",
// resolvedDate: Date,
// confidence: 0.95,
// type: 'relative',
// start: 0,
// end: 16,
// grain: 'hour'
// }
parseDates(text: string): DateExtraction[]Parse all dates found in text.
formatDate(date: Date, style: FormatStyle): stringFormat dates for different use cases.
Format Styles:
context - "Today is Monday, September 15, 2025"hybrid - "next Friday (Sep 19)"compact - "2025-09-15"human - "Monday, September 15, 2025"iso - "2025-09-15T00:00:00.000Z"relative - "in 3 days"addContext(prompt: string): stringAdd temporal context to any prompt.
timeAI.addContext("What should I do today?");
// "Current date: 2025-09-15 (Sunday, 2025)\nTimezone: America/New_York\n\nWhat should I do today?"
import { enhancePrompt, parseDate, addContext } from '@blueprintlabio/time-ai';
// Use default instance
const result = enhancePrompt("Meet tomorrow");
const date = parseDate("next week");
const prompt = addContext("Hello world");
// Or with custom config
const result = enhancePrompt("Meet tomorrow", { timezone: 'UTC' });
For easy migration from existing time utilities:
import { getCurrentTimeContext, formatDateForOpenAI, addDateContextToPrompt } from '@blueprintlabio/time-ai';
// Drop-in replacements for your existing functions
const context = getCurrentTimeContext();
const formatted = formatDateForOpenAI(new Date());
const enhanced = addDateContextToPrompt("Your prompt here");
const timeAI = new TimeAI({ strategy: 'hybrid' });
// Before
const prompt = "Schedule a demo call next Tuesday and send reminder tomorrow";
// After
const enhanced = timeAI.enhancePrompt(prompt);
console.log(enhanced.enhancedText);
// "Schedule a demo call next Tuesday (2025-09-23) and send reminder tomorrow (2025-09-16)"
const timeAI = new TimeAI({ strategy: 'normalize' });
const userInput = "Remind me to call client next Friday";
const result = timeAI.enhancePrompt(userInput);
// Extract absolute date for scheduling
const dateExtraction = result.extractions[0];
const scheduleDate = dateExtraction.resolvedDate; // Exact Date object
// User in New York
const nyTimeAI = new TimeAI({ timezone: 'America/New_York' });
// User in London
const londonTimeAI = new TimeAI({ timezone: 'Europe/London' });
// Same relative date, different absolute times
const prompt = "Meet tomorrow at 9am";
const nyResult = nyTimeAI.enhancePrompt(prompt);
const londonResult = londonTimeAI.enhancePrompt(prompt);
const timeAI = new TimeAI();
function processMessage(userMessage: string) {
// Add temporal awareness to every conversation
const enhanced = timeAI.addContext(userMessage);
// Send to LLM with temporal context
return callLLM(enhanced);
}
The library uses chrono-node internally and includes custom parsers for business contexts:
const timeAI = new TimeAI({ timezone: 'UTC' });
// Change timezone dynamically
timeAI.setTimezone('Asia/Tokyo');
timeAI.setLocale('ja-JP');
// Check timezone-aware comparisons
const isTodayInTokyo = timeAI.isToday(someDate);
The library provides token count estimation for LLM optimization:
const result = timeAI.enhancePrompt("Long prompt with many dates...");
console.log(`Added ${result.tokensAdded} tokens`);
// Use compact context for token-sensitive applications
const timeAI = new TimeAI({ includeContext: false });
Coverage from latest test run:
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)MIT © Blueprint Lab
FAQs
Time-aware utilities for LLM applications - parse dates, add temporal context, and optimize prompts
The npm package @blueprintlabio/time-ai receives a total of 39 weekly downloads. As such, @blueprintlabio/time-ai popularity was classified as not popular.
We found that @blueprintlabio/time-ai demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Lovable’s OJ rewrites Vite’s dev server in Rust, reducing memory use and preview times as AI lowers the cost of open source reimplementation.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.