mirror of
https://github.com/ruilisi/fortune-sheet.git
synced 2025-01-08 11:47:38 +08:00
Merge pull request #553 from ruilisi/551-today-function-is-not-working
Convert result of formulae returning date to string
This commit is contained in:
commit
a11efe3046
@ -1150,10 +1150,21 @@ export function execfunction(
|
||||
*/
|
||||
|
||||
ctx.formulaCache.parser.context = ctx;
|
||||
const { result, error: formulaError } = ctx.formulaCache.parser.parse(
|
||||
txt.substring(1),
|
||||
{ sheetId: id || ctx.currentSheetId }
|
||||
);
|
||||
const parsedResponse = ctx.formulaCache.parser.parse(txt.substring(1), {
|
||||
sheetId: id || ctx.currentSheetId,
|
||||
});
|
||||
|
||||
const { error: formulaError } = parsedResponse;
|
||||
let { result } = parsedResponse;
|
||||
|
||||
// https://stackoverflow.com/a/643827/8200626
|
||||
// https://github.com/ruilisi/fortune-sheet/issues/551
|
||||
if (
|
||||
Object.prototype.toString.call(result) === "[object Date]" &&
|
||||
!_.isNil(result)
|
||||
) {
|
||||
result = result.toString();
|
||||
}
|
||||
|
||||
if (!_.isNil(r) && !_.isNil(c)) {
|
||||
if (isrefresh) {
|
||||
|
Loading…
Reference in New Issue
Block a user