Skip to content

add Cron.serialize #4991

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

Open
wants to merge 1 commit into
base: next-minor
Choose a base branch
from

Conversation

ghardin1314
Copy link

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Add a Cron.serialize method to convert a Cron instance back into a cron string. It is opinionated as to create the most compact cron string possible.

@ghardin1314 ghardin1314 requested a review from mikearnaldi as a code owner June 5, 2025 16:30
@github-project-automation github-project-automation bot moved this to Discussion Ongoing in PR Backlog Jun 5, 2025
Copy link

changeset-bot bot commented Jun 5, 2025

🦋 Changeset detected

Latest commit: c950aa3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
effect Minor
@effect/cli Major
@effect/cluster Major
@effect/experimental Major
@effect/opentelemetry Major
@effect/platform-browser Major
@effect/platform-bun Major
@effect/platform-node-shared Major
@effect/platform-node Major
@effect/platform Major
@effect/printer-ansi Major
@effect/printer Major
@effect/rpc Major
@effect/sql-clickhouse Major
@effect/sql-d1 Major
@effect/sql-drizzle Major
@effect/sql-kysely Major
@effect/sql-libsql Major
@effect/sql-mssql Major
@effect/sql-mysql2 Major
@effect/sql-pg Major
@effect/sql-sqlite-bun Major
@effect/sql-sqlite-do Major
@effect/sql-sqlite-node Major
@effect/sql-sqlite-react-native Major
@effect/sql-sqlite-wasm Major
@effect/sql Major
@effect/typeclass Major
@effect/vitest Major
@effect/workflow Major
@effect/ai Major
@effect/ai-anthropic Major
@effect/ai-openai Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

* @since 3.16.4
* @category serialization / deserialization
*/
export const serialize = (cron: Cron, options?: SerializeOptions): string => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just inline the options, so it is easier to see at a glance.

@tim-smart tim-smart requested review from fubhy and removed request for mikearnaldi June 5, 2025 23:54
@tim-smart
Copy link
Contributor

Also not sure what to do about time zones :)

@effect-bot effect-bot force-pushed the next-minor branch 8 times, most recently from 31a655a to e7a8e68 Compare June 6, 2025 05:36
@fubhy
Copy link
Member

fubhy commented Jun 6, 2025

Also not sure what to do about time zones :)

Yeah. The time zone needs to be part of it. Probably in the same way as for an ISO date string.

I also wonder whether "includeSeconds" should not be an option but instead be a property on the Cron instance that tracks whether it was created with 5 or 6 segments.

@effect-bot effect-bot force-pushed the next-minor branch 11 times, most recently from d300501 to aa74683 Compare June 8, 2025 22:47
@effect-bot effect-bot force-pushed the next-minor branch 13 times, most recently from f201e29 to c7d2dcb Compare June 13, 2025 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Discussion Ongoing
Development

Successfully merging this pull request may close these issues.

3 participants