Skip to content

Instantly share code, notes, and snippets.

@brunohubner
Created August 19, 2023 21:46
Show Gist options
  • Save brunohubner/aa76ffd6befa76f3cecbe0f63b105170 to your computer and use it in GitHub Desktop.
Save brunohubner/aa76ffd6befa76f3cecbe0f63b105170 to your computer and use it in GitHub Desktop.
Notion Formulas for Time Tracking
// Notion Formulas for Time Tracking
// =============================================================================
// Notion Formula to hidden field _minutes:
toNumber(slice(prop("Hours"), 0, 1)) * 60 + toNumber(slice(prop("Hours"), 2, 4))
// Indented version for readability:
toNumber(
slice(
prop("Hours"),
0,
1
)
) * 60 + toNumber(
slice(
prop("Hours"),
2,
4
)
)
// =============================================================================
// Notion Formula to 'Price' field:
48 / 60 * prop("_minutes")
// =============================================================================
// Notion Formula to '_hours' field:
if(empty(slice(format(prop("_minutes") / 60), 1, 2)), prop("_minutes") / 60, toNumber(concat(slice(format(prop("_minutes") / 60), 0, 1),concat(".", slice(format(prop("_minutes") / 60), 2, 4)))))
// Indented version for readability:
if(
empty(
slice(
format(prop("_minutes") / 60),
1,
2
)
),
prop("_minutes") / 60,
toNumber(
concat(
slice(
format(prop("_minutes") / 60),
0,
1
),
concat(
".",
slice(
format(prop("_minutes") / 60),
2,
4
)
)
)
)
) {}
// created by me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment