I want the datum has as default the current date, but the code below shows an empty field and I have the fill in the current date myself. How can the current date as default be achieved?
'Datum': number positive 'datum' @default: now
I want the datum has as default the current date, but the code below shows an empty field and I have the fill in the current date myself. How can the current date as default be achieved?
'Datum': number positive 'datum' @default: now
now
produces a date time
in seconds, which you need to convert to a date
, as discussed in this post:
Some examples of rules and annotations that are useful when working with dates and date times:
root {
// @date-time overrides the conversion specified in the numerical-types section,
// by using the time zone of the browser for a date-time to date conversion.
'My Date': number 'date' @default: from @date-time 'date and time' now
}
numerical-types
'seconds'
= 'days' * 86400 * 10 ^ 0
'date and time': time-in-seconds in 'seconds' // time-in-seconds is required for timers
= 'date'+ 0 * 10 ^ 0 in 'days'
@date-time // annotation for showing date-time picker
'days'
= 'seconds' / 86400 * 10 ^ 0
'date' in 'days'
= 'date and time'+ 0 * 10 ^ 0 in 'seconds'
@date // annotation for showing date picker