Spaces:
Sleeping
Sleeping
Download frontend/src/lib/utils.ts from shaun07/grid-backtest: direct link, hf CLI and curl.
- Browser
- Download file 734 Bytes
-
https://huggingface.co/spaces/shaun07/grid-backtest/resolve/main/frontend/src/lib/utils.ts
- Command line
-
hf download hf://spaces/shaun07/grid-backtest/frontend/src/lib/utils.ts
-
curl -L -o utils.ts https://huggingface.co/spaces/shaun07/grid-backtest/resolve/main/frontend/src/lib/utils.ts
734 Bytes
| import { type ClassValue, clsx } from "clsx" | |
| import { twMerge } from "tailwind-merge" | |
| export function cn(...inputs: ClassValue[]) { | |
| return twMerge(clsx(inputs)) | |
| } | |
| export function formatCurrency(value: number): string { | |
| return new Intl.NumberFormat('zh-CN', { | |
| style: 'currency', | |
| currency: 'CNY' | |
| }).format(value) | |
| } | |
| export function formatPercentage(value: number): string { | |
| return `${value.toFixed(2)}%` | |
| } | |
| export function formatDate(date: Date | string): string { | |
| const d = typeof date === 'string' ? new Date(date) : date | |
| return d.toLocaleString('zh-CN', { | |
| year: 'numeric', | |
| month: '2-digit', | |
| day: '2-digit', | |
| hour: '2-digit', | |
| minute: '2-digit', | |
| second: '2-digit', | |
| hour12: false | |
| }) | |
| } | |