数字#
一份参考文档,列出了内置的便捷函数,用于支持表达式中对数字进行数据转换。
表达式中的JavaScript
你可以在表达式中使用任何JavaScript。更多信息请参考Expressions。
ceil(): 数字 #
将数字向上舍入为整数。
floor(): 数字 #
将一个数字向下取整为整数。
format(locales?: LanguageCode, options?: FormatOptions): String #
This is a wrapper around Intl.NumberFormat(). Returns a formatted string of a number based on the given LanguageCode and FormatOptions. When no arguments are given, transforms the number in a like format 1.234.
函数参数#
localesOptionalString
一个IETF BCP 47语言标签。
isEven(): Boolean #
如果数字是偶数则返回true。仅适用于整数。
isOdd(): 布尔值 #
如果数字为奇数则返回true。仅适用于整数。
round(decimalPlaces?: Number): Number #
返回一个四舍五入到最接近整数的数值,除非指定了小数位数。
函数参数#
decimalPlacesOptionalNumber
要四舍五入到多少位小数。
toBoolean(): 布尔值 #
Converts a number to a boolean.
0 converts to false. All other values convert to true.
toDateTime(format?: String): Date #
Converts a number to a Luxon日期对象.
函数参数#
formatOptionalString enum
可以是 ms(毫秒)、s(秒)或 excel(Excel 1900)。默认为毫秒。