date-fns#subWeeks TypeScript Examples
The following examples show how to use
date-fns#subWeeks.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: infoQueryHelpers.ts From glide-frontend with GNU General Public License v3.0 | 5 votes |
getDeltaTimestamps = (): [number, number, number, number] => {
const utcCurrentTime = getUnixTime(new Date()) * 1000
const t24h = getUnixTime(startOfMinute(subDays(utcCurrentTime, 1)))
const t48h = getUnixTime(startOfMinute(subDays(utcCurrentTime, 2)))
const t7d = getUnixTime(startOfMinute(subWeeks(utcCurrentTime, 1)))
const t14d = getUnixTime(startOfMinute(subWeeks(utcCurrentTime, 2)))
return [t24h, t48h, t7d, t14d]
}
Example #2
Source File: sleep-data-helper.spec.ts From nyxo-app with GNU General Public License v3.0 | 5 votes |
wrongNight = subWeeks(new Date('2020-12-12'), 1).toISOString()
Example #3
Source File: infoQueryHelpers.ts From vvs-ui with GNU General Public License v3.0 | 5 votes |
getDeltaTimestamps = (): [number, number, number, number] => {
const utcCurrentTime = getUnixTime(new Date()) * 1000
const t24h = getUnixTime(startOfMinute(subDays(utcCurrentTime, 1)))
const t48h = getUnixTime(startOfMinute(subDays(utcCurrentTime, 2)))
const t7d = getUnixTime(startOfMinute(subWeeks(utcCurrentTime, 1)))
const t14d = getUnixTime(startOfMinute(subWeeks(utcCurrentTime, 2)))
return [t24h, t48h, t7d, t14d]
}
Example #4
Source File: VisitorListAside.tsx From ra-enterprise-demo with MIT License | 4 votes |
Aside: FC = () => (
<Card>
<CardContent>
<FilterLiveSearch />
<span id="persisted-queries">
<SavedQueriesList />
</span>
<FilterList
label="resources.customers.filters.last_visited"
icon={<AccessTimeIcon />}
>
<FilterListItem
label="resources.customers.filters.today"
value={{
last_seen_gte: endOfYesterday().toISOString(),
last_seen_lte: undefined,
}}
/>
<FilterListItem
label="resources.customers.filters.this_week"
value={{
last_seen_gte: startOfWeek(new Date()).toISOString(),
last_seen_lte: undefined,
}}
/>
<FilterListItem
label="resources.customers.filters.last_week"
value={{
last_seen_gte: subWeeks(
startOfWeek(new Date()),
1
).toISOString(),
last_seen_lte: startOfWeek(new Date()).toISOString(),
}}
/>
<FilterListItem
label="resources.customers.filters.this_month"
value={{
last_seen_gte: startOfMonth(new Date()).toISOString(),
last_seen_lte: undefined,
}}
/>
<FilterListItem
label="resources.customers.filters.last_month"
value={{
last_seen_gte: subMonths(
startOfMonth(new Date()),
1
).toISOString(),
last_seen_lte: startOfMonth(new Date()).toISOString(),
}}
/>
<FilterListItem
label="resources.customers.filters.earlier"
value={{
last_seen_gte: undefined,
last_seen_lte: subMonths(
startOfMonth(new Date()),
1
).toISOString(),
}}
/>
</FilterList>
<FilterList
label="resources.customers.filters.has_ordered"
icon={<MonetizationOnIcon />}
>
<FilterListItem
label="ra.boolean.true"
value={{
nb_commands_gte: 1,
nb_commands_lte: undefined,
}}
/>
<FilterListItem
label="ra.boolean.false"
value={{
nb_commands_gte: undefined,
nb_commands_lte: 0,
}}
/>
</FilterList>
<FilterList
label="resources.customers.filters.has_newsletter"
icon={<MailIcon />}
>
<FilterListItem
label="ra.boolean.true"
value={{ has_newsletter: true }}
/>
<FilterListItem
label="ra.boolean.false"
value={{ has_newsletter: false }}
/>
</FilterList>
<FilterList
label="resources.customers.filters.group"
icon={<LocalOfferIcon />}
>
{segments.map(segment => (
<FilterListItem
label={segment.name}
key={segment.id}
value={{ groups: segment.id }}
/>
))}
</FilterList>
</CardContent>
</Card>
)