How to use the dayjs.unix 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 Ice-Hazymoon / MikuTools / pages / linux_command.vue View on Github external
mounted() {
        if (this.$db.get('linux_command').value()) {
            const currentDate = dayjs();
            const storageDate = this.$db.get('linux_command.time').value();
            if (currentDate.diff(dayjs.unix(storageDate), 'day') > 1) {
                this.getData();
            } else {
                this.data = this.$db.get('linux_command.data').value();
                this.geting = false;
            }
        } else {
            this.getData();
        }
    },
    methods: {
github OriginProtocol / origin / origin-dapp / src / pages / messaging / Message.js View on Github external
const message = get(props, 'message', {})
  const identity = isNil(props.identity) ? {} : props.identity
  const messageContent = renderContent(message)
  const userName = abbreviateName(identity, 'Unnamed User')
  const userAddress = truncateAddress(props.wallet)
  const { showTime, showTailAndAvatar } = showItems(props)
  const { justifyContent, contentOnly, userType } = getCssClasses(
    props.isUser,
    showTailAndAvatar
  )

  return (
    <>
      {showTime && (
        <div>
          {dayjs.unix(message.timestamp).format('MMM Do h:mmA')}
        </div>
      )}
      <div>
        <div>
          {!props.isUser &amp;&amp; showTailAndAvatar &amp;&amp; (
            <div>
              
            </div>
          )}
          <div>
            <div>
              {props.isUser ? (
                
              ) : (</div></div></div></div>
github sablierhq / sablier / packages / frontend / src / helpers / time-utils.js View on Github external
export function roundTimeAroundHour(time) {
  if (!isDayJs(time)) {
    throw new Error(`Expected ${time} to be an instance of dayjs`);
  }
  const coefficient = 60 * INTERVAL_MINUTES.hour;
  return dayjs.unix(Math.round(time.unix() / coefficient) * coefficient);
}
github zz570557024 / vue-mpvue-ChatRobot / src / filter / index.js View on Github external
Vue.filter('timeUnixFormat', function (value, format) {
  return value ? moment.unix(value).format(format || 'YYYY-MM-DD HH:mm:ss') : '';
})
github pingcap / tidb-dashboard / ui / lib / apps / Statement / pages / List / TimeRangeSelector.tsx View on Github external
'statement.pages.overview.toolbar.time_range_selector.custom_time_ranges'
          )}
        
         dayjs.unix(val).format('HH:mm')}
        /&gt;
        <span>
          {dayjs.unix(sliderTimeRange.begin_time!).format('MM-DD HH:mm')} ~{' '}
          {dayjs.unix(sliderTimeRange.end_time!).format('MM-DD HH:mm')}
        </span>
      
    
  )

  return (
    
      <button>}&gt;
        {curTimeRange.type === 'recent' ? (
          <span></span></button>
github rate-engineering / rate3-monorepo / packages / demo / token-swap / src / components / common / TxProgress.tsx View on Github external
render() {
    const { classes, tx, direction, userSetValue } = this.props;
    const amount = userSetValue;
    const transaction = tx ? tx : {};
    const stellarTime = transaction.created_at && day(transaction.created_at).format(FORMAT);
    const ethTime = transaction.requestTimestamp
      && day.unix(transaction.requestTimestamp).format(FORMAT);
    const stellarApprovalTime = transaction.fromBlockchain ?
      (transaction.timestamp
      && day.unix(transaction.timestamp).format(FORMAT))
      : (transaction.stellarTokenMintTimestamp &&
      day(transaction.stellarTokenMintTimestamp).format(FORMAT));
    const ethApprovalTime = transaction.unlockTimestamp
      && day.unix(transaction.unlockTimestamp).format(FORMAT);

    const calProgress = (tran, ...fields) => {
      if (tran.fromBlockchain) return 100;
      const total = fields.length;
      let prog = 0;
      fields.forEach((field) => {
        if (evaluateToBool(tran, field)) {
          prog += 1;
        }
github wangyupo / vue-vuex-router / src / filters / index.js View on Github external
const timeFilter = (value) => {
    value = value.toString();
    if (value) {
        if (value.length === 13) {
            return dayjs(Number(value)).format("YYYY-MM-DD HH:mm:ss");
        }
        return dayjs.unix(Number(value)).format("YYYY-MM-DD HH:mm:ss");
    } else {
        return '-';
    }
}
github openkfw / TruBudget / frontend / src / helper.js View on Github external
export const unixTsToString = ts => {
  let dateString = dayjs.unix(ts).format("MMM D, YYYY");
  return dateString;
};
github OriginProtocol / origin / dapps / marketplace / src / components / EventTick.js View on Github external
const displayEventDate = timestamp =>
  displayDateTime(dayjs.unix(timestamp), {
    day: 'numeric',
    month: 'short',
    year: 'numeric'
  })
const sentenceCase = str =>
github OriginProtocol / origin / dapps / marketplace / src / pages / transaction / _History.js View on Github external
const date = timestamp => dayjs.unix(timestamp).format('MMM. D, YYYY h:mmA')
const eventName = name => {

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