Skip to content

Commit

Permalink
Merge pull request #61 from ofuton/fix-bug
Browse files Browse the repository at this point in the history
Fix bug due to incorrect assumption of seconds
  • Loading branch information
emiksk committed Jul 3, 2023
2 parents 5ade0bd + 575e42d commit 9e61eda
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "maimodorun",
"private": true,
"version": "2.0.1",
"version": "2.0.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src/popup/component/Histories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,5 @@ const RecordCardTag: React.FC<RecordCardTagProps> = ({ scope }) => {
}

const fromNow = (timestamp: number): string => {
return dayjs.unix(timestamp).fromNow()
return dayjs(timestamp).fromNow()
}
16 changes: 8 additions & 8 deletions tests/popup/component/Histories.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ describe('src/popup/component/Histories.tsx', () => {
})

it('数秒前', () => {
const now = 1234567890
vi.setSystemTime(dayjs.unix(now).toDate())
const nowMilliSec = 1234567890000
vi.setSystemTime(dayjs(nowMilliSec).toDate())
const props = {
histories: [{
scope: 'thread.root',
url: 'https://example.com/1',
title: 'Example Title',
iconUrl: 'https://example.com/icon',
timestamp: now - 5,
timestamp: nowMilliSec - 5 * 1000,
content: '<span>tags will be removed</span>'
}],
clickTrashButtonHandler: async (_: string) => {},
Expand All @@ -162,14 +162,14 @@ describe('src/popup/component/Histories.tsx', () => {

it('5分前', () => {
const now = 1234567890
vi.setSystemTime(dayjs.unix(now).toDate())
vi.setSystemTime(dayjs(now).toDate())
const props = {
histories: [{
scope: 'thread.root',
url: 'https://example.com/1',
title: 'Example Title',
iconUrl: 'https://example.com/icon',
timestamp: now - 5 * 60,
timestamp: now - 5 * 60 * 1000,
content: '<span>tags will be removed</span>'
}],
clickTrashButtonHandler: async (_: string) => {},
Expand All @@ -181,15 +181,15 @@ describe('src/popup/component/Histories.tsx', () => {
})

it('1日前', () => {
const now = 1234567890
vi.setSystemTime(dayjs.unix(now).toDate())
const now = 1234567890000
vi.setSystemTime(dayjs(now).toDate())
const props = {
histories: [{
scope: 'thread.root',
url: 'https://example.com/1',
title: 'Example Title',
iconUrl: 'https://example.com/icon',
timestamp: now - 60 * 60 * 24,
timestamp: now - 60 * 60 * 24 * 1000,
content: '<span>tags will be removed</span>'
}],
clickTrashButtonHandler: async (_: string) => {},
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import zipPack from 'vite-plugin-zip-pack'
const manifest = defineManifest({
manifest_version: 3,
name: 'Maimodorun',
version: '2.0.1',
version: '2.0.2',
description: 'maimodorun: Recovery Tool for Forms on kintone',
icons: {
16: 'assets/icon16.png',
Expand Down

0 comments on commit 9e61eda

Please sign in to comment.