How to use the dayjs function in dayjs

To help you get started, we’ve selected a few dayjs 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 mathieustan / vue-datepicker / tests / unit / components / datepicker / DatePickerYearMonth.spec.js View on Github external
describe('isSelectedYear', () => {
      it.each([
        [dayjs(new Date([2018, 5, 16])), 2018, true],
        [dayjs(new Date([2018, 5, 16])), 2019, false],
      ])(
        'when currentDate equal %p, and year is %p, should return %p',
        (date, year, expectedResult) => {
          const wrapper = mountComponent({
            date: new Dates(date.month(), date.year(), { lang: 'en' }),
          });
          expect(wrapper.vm.isSelectedYear(year)).toEqual(expectedResult);
        }
      );
    });
github apache / incubator-dolphinscheduler / escheduler-ui / src / js / conf / home / pages / user / pages / token / _source / createToken.vue View on Github external
_submit () {
        let param = {
          expireTime: dayjs(this.expireTime).format('YYYY-MM-DD HH:mm:ss'),
          userId: this.userId,
          token: this.token
        }
        if (this.item) {
          param.id = this.item.id
        }
        this.$refs['popup'].spinnerLoading = true
        this.store.dispatch(`user/${this.item ? 'updateToken' : 'createToken'}`, param).then(res => {
          this.$emit('onUpdate')
          this.$message.success(res.msg)
          setTimeout(() => {
            this.$refs['popup'].spinnerLoading = false
          }, 800)
        }).catch(e => {
          this.$message.error(e.msg || '')
          this.$refs['popup'].spinnerLoading = false
github sablierhq / sablier / packages / website / src / pages / Stream / StopModal / index.js View on Github external
render() {
    const { stopTime, t, tokenName, totalValue, withdrawable } = this.props;

    const isWithdrawable = withdrawable !== 0;
    return (
       this.onClose()}>
        <div>
          <span>
            {t("confirm")} {t("action")}
          </span>
          <div>
          <span>
            {t("stopAndWithdrawWarning", {
              withdrawableLabel: `${withdrawable} ${tokenName}`,
              leftoverIncomeLabel: `${totalValue - withdrawable} ${tokenName}`,
              stopTimeLabel: formatTime(t, dayjs(stopTime), false),
            })}
          </span>
           this.onClickStopAndWithdraw()}
            label={`${t("stopAndWithdraw")} ${withdrawable} ${tokenName}`}
          /&gt;
        </div>
      
    );</div>
github TaleLin / lin-cms-koa-core / lib / file.ts View on Github external
public getFormatDay() {
    return dayjs().format('YYYY/MM/DD');
  }
github blockstack / stacks-wallet / app / components / transaction-item / index.js View on Github external
const Date = ({ date, ...rest }) =&gt;
  date ? (
    
      
        {dayjs(date)
          .format("MMM")
          .toUpperCase()}
      
      
        {dayjs(date).format("DD")}
      
    
  ) : null;
const getTitle = (item, stx) =&gt; {
github replicatedhq / kots / web / src / components / snapshots / SnapshotDetails.jsx View on Github external
hooks.map((hook, i) =&gt; {
        const diffMinutes = dayjs(hook?.finishedAt).diff(dayjs(hook?.startedAt), "minutes");
        return (
          <div>
            <div>
              <div>
                <p>{hook.name} <span>Pod: {hook.podName} </span> </p>
                <span> {hook.command} </span>
              </div>
            </div>
            <div>
              <p><span>{hook.errors ? "Failed" : "Completed"}</span></p>
              {!hook.errors &amp;&amp;
                <p> Finished in {diffMinutes === 0 ? "less than a minute" : `${diffMinutes} minutes`} </p>}
              {hook.stderr !== "" || hook.stdout !== "" &amp;&amp;
                <span> this.toggleScriptsOutput(hook)}&gt; View output </span>}
            </div>
          </div>
github neuronetio / gantt-elastic / src / GanttElastic.vue View on Github external
recalculateTimes() {
      let max = this.state.options.times.timeScale * 60;
      let min = this.state.options.times.timeScale;
      let steps = max / min;
      let percent = this.state.options.times.timeZoom / 100;
      this.state.options.times.timePerPixel =
        this.state.options.times.timeScale * steps * percent + Math.pow(2, this.state.options.times.timeZoom);
      this.state.options.times.totalViewDurationMs = dayjs(this.state.options.times.lastTime).diff(
        this.state.options.times.firstTime,
        'milliseconds'
      );
      this.state.options.times.totalViewDurationPx =
        this.state.options.times.totalViewDurationMs / this.state.options.times.timePerPixel;
      this.state.options.width =
        this.state.options.times.totalViewDurationPx + this.style['grid-line-vertical']['stroke-width'];
    },
github autoai-org / AID / components / dashboard / src / middlewares / api.mdw.ts View on Github external
res = res.map(function (each) {
                    each.CreatedAt = dayjs(each.CreatedAt).format("DD/MM/YYYY HH:mm")
                    return each
                })
                resolve(res)

dayjs

2KB immutable date time library alternative to Moment.js with the same modern API

MIT
Latest version published 2 months ago

Package Health Score

88 / 100
Full package analysis