Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function formatDayOfYear(d, p) {
return pad(1 + timeDay.count(timeYear(d), d), p, 3);
}
t,
prolongBeforeDate,
router,
inNativeApp,
inNativeIOSApp,
dark: inDarkFrame
}) => {
if (
router.pathname === '/pledge' ||
router.pathname === '/cancel' ||
router.pathname === '/meta'
) {
return null
}
const date = new Date(prolongBeforeDate)
const numberOfDays = timeDay.count(new Date(), date)
if (numberOfDays <= 30) {
const key =
numberOfDays <= 2 ? (numberOfDays < 0 ? 'overdue' : 'due') : 'before'
const baseKey = `prolongNecessary/${key}`
const dark = inDarkFrame || key !== 'before'
const colorStyle = { color: dark ? '#fff' : undefined }
const explanation = t.elements(
`${baseKey}/explanation`,
{
cancelLink: (
{t(`${baseKey}/explanation/cancelText`)}
(days, period) =>
days +
timeDay.count(
new Date(period.beginDate),
new Date(period.endDate)
),
0
.map(period => {
const beginDate = new Date(period.beginDate)
const endDate = new Date(period.endDate)
const formattedEndDate = dayFormat(endDate)
const days = timeDay.count(beginDate, endDate)
const title = t.first(
[
`option/${pkg.name}/additionalPeriods/${period.kind}/title`,
`option/${pkg.name}/additionalPeriods/title`
],
{
formattedEndDate,
days
}
)
const explanation = t.first(
[
`option/${pkg.name}/additionalPeriods/${period.kind}/explanation`,
`option/${pkg.name}/additionalPeriods/explanation`
],