-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Add unix-timestamp-converter extension #18949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- chore(metadata): update screenshot images with resized versions - feat(assets): add icon and screenshot images - docs: add README and CHANGELOG - chore(package): define extension metadata, commands, dependencies, and npm scripts in package.json - feat(generate): add feature to convert date to UNIX timestamp - feat(convert): add feature to convert UNIX timestamp to date - feat(utils): implement date conversion and clipboard utility functions - feat(constants): add supported countries and formats definitions - chore(deps): add package-lock.json - first commit
Congratulations on your new Raycast extension! 🚀 You can expect an initial review within five business days. Once the PR is approved and merged, the extension will be available on our Store. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Let me provide a concise review of this new Unix Timestamp Converter extension:
A comprehensive extension that enables conversion between Unix timestamps and human-readable dates across multiple timezones and formats, with a clean form-based interface and clipboard integration.
Key points:
- Japanese comments in
datetime.ts
andtypes.ts
should be translated to English to comply with Raycast's English-only localization policy showFailureToast
from@raycast/utils
should be used in try-catch blocks instead of manualshowToast
calls for error handlingmetadata
folder with screenshots is missing but required since there areview
commands inpackage.json
copyToClipboardWithToast
inclipboard.ts
should include error handling for clipboard access failures- Timezone offset calculations in
getUnixTimeFromLocalDate()
need to handle DST edge cases
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
13 file(s) reviewed, 19 comment(s)
Edit PR Review Bot Settings | Greptile
{ | ||
"name": "convert-timestamp", | ||
"title": "Convert Timestamp", | ||
"subtitle": "Unix Time Converter", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Both commands have the same subtitle 'Unix Time Converter'. Consider using the extension title as subtitle to help users identify which extension the command belongs to.
if (!country || !format) return; | ||
const date = getDateFromUnixTime(Number(values.unixTime)); | ||
const result = format.format(date, country); | ||
copyToClipboardWithToast(result.split(": ")[1] ?? "", "Datetime copied!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Splitting on ': ' is fragile - consider using a more robust way to extract the formatted date portion
}, | ||
}); | ||
|
||
// 結果のプレビュー |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Japanese comment '結果のプレビュー' should be in English for consistency
// 結果のプレビュー | |
// Preview of the result |
onSubmit(values) { | ||
const country = countries.find((c) => c.id === values.country); | ||
const format = formats.find((f) => f.id === values.format); | ||
if (!country || !format) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Silent return on invalid country/format - should show error toast
if (!country || !format) return; | |
if (!country || !format) { | |
showFailureToast(new Error("Invalid country or format selected")); | |
return; | |
} |
* 国情報 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Raycast only supports US English. Comments should be in English instead of Japanese ('Country information')
* 国情報 | |
*/ | |
* Country information | |
*/ |
export type Country = { | ||
id: string; | ||
name: string; | ||
timezoneOffset: number; // UTCからのオフセット(例: 9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Comment should be in English ('UTC offset (e.g.: 9)')
timezoneOffset: number; // UTCからのオフセット(例: 9) | |
timezoneOffset: number; // UTC offset (e.g.: 9) |
* 日時フォーマット | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Comment should be in English ('Date format')
* 日時フォーマット | |
*/ | |
* Date format | |
*/ |
* convert-timestampコマンド用フォーム値 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Comment should be in English ('Form values for convert-timestamp command')
* convert-timestampコマンド用フォーム値 | |
*/ | |
* Form values for convert-timestamp command | |
*/ |
* generate-timestampコマンド用フォーム値 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Comment should be in English ('Form values for generate-timestamp command')
* generate-timestampコマンド用フォーム値 | |
*/ | |
* Form values for generate-timestamp command | |
*/ |
In the US, the 12-hour clock is standard, so hour12 was changed from false to true.
…ero-pad date/time to 2 digits
…g date value instead of string split Changed the result of format.format to return an object with name and value properties. Now, the date value is accessed directly from the value property, making the extraction more robust and maintainable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
Based on the recent changes, here's a focused review of the Unix Timestamp Converter extension updates:
A well-structured update that improves error handling, standardizes terminology, and enhances the overall code quality of the Unix Timestamp Converter extension.
Key points:
- Standardized terminology from 'USA' to 'United States' across documentation for consistency
- Added structured result objects with
name
andvalue
properties in format functions - Improved form validation with proper error handling using
showFailureToast
- Simplified state management by using
useState
for result text - Added zero-padding utility for date components with well-documented
pad2
function
The implementation shows good attention to detail and follows Raycast's best practices, particularly in error handling and user feedback mechanisms.
9 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
{ id: "japan", name: "Japan", timezoneOffset: 9, timezoneName: "JST", ianaTimeZone: "Asia/Tokyo" }, | ||
{ id: "new_york", name: "USA (New York)", timezoneOffset: -5, timezoneName: "EST", ianaTimeZone: "America/New_York" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: EST/PST are not fixed timezone names and change with daylight savings. Consider using ET/PT instead.
format: (date, country) => { | ||
return { name: `${country.name} Time (${country.timezoneName})`, value: date.toISOString() }; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Return type doesn't match other format functions which return strings. This will cause type inconsistency.
format: (date, country) => { | |
return { name: `${country.name} Time (${country.timezoneName})`, value: date.toISOString() }; | |
}, | |
format: (date, country) => { | |
return `${country.name} Time (${country.timezoneName}): ${date.toISOString()}`; | |
}, |
locale: string, | ||
options: Intl.DateTimeFormatOptions, | ||
): { name: string; value: string } => { | ||
return {name : `${country.name} Time (${country.timezoneName})`, value: `${date.toLocaleString(locale, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Inconsistent spacing around object property name. Should be { name:
not {name :
Description
This PR adds a new Raycast extension: Unix Timestamp Converter.
Overview
Unix Timestamp Converter is a tool that allows you to easily convert between Unix timestamps (epoch seconds) and human-readable date and time formats (e.g., YYYY-MM-DD HH:mm:ss).
It streamlines the timestamp conversion tasks that engineers and developers often perform, making them quick and convenient right within Raycast.
Key Features
Enter a Unix timestamp and instantly see it converted to the local date and time of your selected country or timezone.
Enter a date and time (e.g., 2024-06-01 12:34:56) and convert it to a Unix timestamp as if it were in the local time of your selected country or timezone.
Easily copy the conversion result to your clipboard with a single click, making it simple to paste into other apps or services.
Supported Timezones
Supported Date Formats
How to Use
2.2Enter the value you want to convert (either a Unix timestamp or a date), and select the country and display format.
With this extension, you can quickly handle timestamp conversions directly in Raycast, without needing to search the web or use external tools.
Screencast
Convert Unix timestamps to local date and time
Convert.Unix.timestamps_to_local_date_and.time.mov
Convert date and time to Unix timestamps
Convert_date_and_time_to_Unix.timestamps.mov
Checklist
npm run build
and tested this distribution build in Raycastassets
folder are used by the extension itselfREADME
are placed outside of themetadata
folder