How to use the @instructure/ui-i18n.DateTime.now function in @instructure/ui-i18n

To help you get started, we’ve selected a few @instructure/ui-i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instructure / instructure-ui / packages / ui-forms / src / TimeInput / index.js View on Github external
getBaseDateForRendering (defaultValue, locale, timezone, value) {
    let baseDate
    const baseValue = value || defaultValue
    if (baseValue) {
      baseDate = DateTime.parse(baseValue, locale, timezone)
    } else {
      baseDate = DateTime.now(locale, timezone)
    }
    return baseDate.second(0).millisecond(0)
  }
github instructure / instructure-ui / packages / ui-forms / src / DateInput / DatePicker / index.js View on Github external
constructor (props, context) {
    super(props, context)

    const locale = this._locale(props, context)
    const timezone = this._timezone(props, context)

    const defaultTodayValue = DateTime.now(locale, timezone)
      .hour(0)
      .minute(0)
      .second(0)
      .millisecond(0)
      .format()

    const todayValue = this._validateDateProp(
      props.todayValue,
      defaultTodayValue,
      'todayValue',
      locale,
      timezone
    )

    const selectedValue = this._validateDateProp(
      props.selectedValue || props.defaultSelectedValue,
github instructure / instructure-ui / packages / ui-forms / src / DateInput / index.js View on Github external
get calendarSelectedValue () {
    const { acceptedValue } = this.state

    let value = acceptedValue ? this.parseDate(acceptedValue) : undefined

    if (!value || !value.isValid()) {
      value = DateTime.now(this.locale, this.timezone)
    }

    return value.toISOString(true)
  }