Skip to content

Instantly share code, notes, and snippets.

@hecker
Created March 11, 2023 14:20
Show Gist options
  • Save hecker/bf65bbb0ebf362a415dfe20ee8904bce to your computer and use it in GitHub Desktop.
Save hecker/bf65bbb0ebf362a415dfe20ee8904bce to your computer and use it in GitHub Desktop.
Notion Template "Subscriptions" – Formulas
/// Use the Notion template:
/// https://janhecker.notion.site/dc8cc219c76e4af49bd49105a565a2de?v=ce428f09c9a146cbabb073709b81af43
///
/// Use this link to convert the code into a one-liner for Notion:
/// https://www.textfixer.com/tools/remove-line-breaks.php
/// Active until
dateAdd(
prop("Last renewal / bought"),
if (prop("Subscription") == "Weekly", 7, if (prop("Subscription") == "Monthly", 30, if (prop("Subscription") == "Yearly", 365, 0))),
"days"
)
/// Deadline to cancel
if (prop("Cancelled") == false,
dateAdd(
prop("Last renewal / bought"),
subtract((if (prop("Subscription") == "Weekly", 7, if (prop("Subscription") == "Monthly", 30, if (prop("Subscription") == "Yearly", 365, 0)))), prop("Notice period in days")),
"days"
),
fromTimestamp(toNumber(""))
)
/// Yearly costs
if (prop("Subscription") == "Yearly", prop("Price"),
if (prop("Subscription") == "Monthly", prop("Price") * 12,
if (prop("Subscription") == "Weekly", prop("Price") * 52, 0)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment