Module Contents



class core.bones.dateBone.dateBone(creationMagic=False, updateMagic=False, date=True, time=True, localize=False, *args, **kwargs)

Bases: viur.core.bones.baseBone

type = date
static generageSearchWidget(target, name='DATE BONE', mode='range')
singleValueFromClient(self, value, skel, name, origData)

Reads a value from the client. If this value is valid for this bone, store this value and return None. Otherwise our previous value is left unchanged and an error-message is returned.

Value is assumed to be in local time zone only if both and self.time are set to True and self.localize is True.

Value is valid if, when converted into String, it complies following formats:

  • is digit (may include one ‘-‘) and valid POSIX timestamp: converted from timestamp; assumes UTC timezone

  • is digit (may include one ‘-‘) and NOT valid POSIX timestamp and not date and time: interpreted as seconds after epoch

  • ‘now’: current time

  • ‘nowX’, where X converted into String is added as seconds to current time

  • ‘%H:%M:%S’ if not date and time

  • ‘%M:%S’ if not date and time

  • ‘%S’ if not date and time

  • ‘%Y-%m-%d %H:%M:%S’ (ISO date format)

  • ‘%Y-%m-%d %H:%M’ (ISO date format)

  • ‘%Y-%m-%d’ (ISO date format)

  • ‘%m/%d/%Y %H:%M:%S’ (US date-format)

  • ‘%m/%d/%Y %H:%M’ (US date-format)

  • ‘%m/%d/%Y’ (US date-format)

  • ‘%d.%m.%Y %H:%M:%S’ (EU date-format)

  • ‘%d.%m.%Y %H:%M’ (EU date-format)

  • ‘%d.%m.%Y’ (EU date-format)

The resulting year must be >= 1900.

  • name (str) – Our name in the skeleton

  • value (str(value) has to be of valid format) – User-supplied request-data


tuple[datetime or None, [Errors] or None]

isInvalid(self, value)

Ensure that year is >= 1900 Otherwise strftime will break later on.


Guess the timezone the user is supposed to be in. If it cant be guessed, a safe default (UTC) is used

singleValueSerialize(self, value, skel: SkeletonInstance, name: str, parentIndexed: bool)
singleValueUnserialize(self, value, skel: viur.core.skeleton.SkeletonInstance, name: str)
buildDBFilter(self, name, skel, dbFilter, rawFilter, prefix=None)
performMagic(self, valuesCache, name, isAdd)