1 package org.simantics.spreadsheet.graph.formula;
3 import java.time.LocalDate;
4 import java.time.Month;
5 import java.time.temporal.ChronoUnit;
6 import java.time.temporal.Temporal;
8 import org.simantics.spreadsheet.graph.CellFormulaFunction;
9 import org.simantics.spreadsheet.graph.CellValueVisitor;
10 import org.simantics.spreadsheet.graph.parser.ast.AstArgList;
12 public class TodayFormulaFunction implements CellFormulaFunction<Long> {
14 private Temporal baseline = LocalDate.of(1899, Month.DECEMBER, 30);
17 public Long evaluate(CellValueVisitor visitor, AstArgList args) {
18 return Long.valueOf(ChronoUnit.DAYS.between(baseline, LocalDate.now()));