Download wp-calypso/client/a8c-for-agencies/sections/reports/lib/timeframes.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 896 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/a8c-for-agencies/sections/reports/lib/timeframes.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/a8c-for-agencies/sections/reports/lib/timeframes.ts
-
curl -L -o timeframes.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/a8c-for-agencies/sections/reports/lib/timeframes.ts
896 Bytes
| import type { TimeframeOption } from '../types'; | |
| /** | |
| * Get available timeframes for report building | |
| */ | |
| export const getAvailableTimeframes = ( | |
| translate: ( key: string, args?: Record< string, unknown > ) => string | |
| ): TimeframeOption[] => [ | |
| { label: translate( 'Last 30 days' ), value: '30_days' }, | |
| { label: translate( 'Last 7 days' ), value: '7_days' }, | |
| { label: translate( 'Last 24 hours' ), value: '24_hours' }, | |
| { label: translate( 'Custom range' ), value: 'custom' }, | |
| ]; | |
| /** | |
| * Get display text for a specific timeframe value | |
| */ | |
| export const getTimeframeText = ( | |
| timeframe: string, | |
| translate: ( key: string, args?: Record< string, unknown > ) => string | |
| ): string => { | |
| const availableTimeframes = getAvailableTimeframes( translate ); | |
| const matchingTimeframe = availableTimeframes.find( ( option ) => option.value === timeframe ); | |
| return matchingTimeframe?.label || timeframe; | |
| }; | |