OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-store / store / lib / date.js

20 lines · javascript ref:
export const MS_SECOND = 1e3
export const MS_MINUTE = 6e4
export const MS_5_MINUTES = 3e5
export const MS_10_MINUTES = 6e5
export const MS_20_MINUTES = 12e5
export const MS_HOUR = 36e5
export const MS_DAY = 864e5
export function formatTimestamp(t) {
  const e = new Date(t)
  return `${e.getFullYear()}/${e.getMonth() + 1}/${e.getDate()}`
}
export const getStartOfDay = (t) => {
  const e = new Date(t)
  return (e.setHours(0, 0, 0, 0), e)
}
export const getStartOfNextDay = (t) => {
  const e = getStartOfDay(t)
  return (e.setDate(e.getDate() + 1), e)
}