question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autodetect parse with seconds

See original GitHub issue

Hi, I’m using Cronos inside application which read user configurations which could have standard minutes form or extended with seconds. Problem is, i do not know if user enter one or another and Parse() method without second parameter throws Cronos.CronFormatException: Unexpected character '*'.. How should i detect if it is standard form or extended when Cronos can’t detect it by itself?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
odinserjcommented, Mar 30, 2018

The * * * * * * expression is ambiguous – some parsers treat the first part as a second value, other parsers treat the first part as a minute, and last part as an year value – that’s why there’s no auto-detection mechanism in Cronos for this case.

If your values only include seconds as a six-part expressions, then you can use the String.Split method to count the number of parts in a cron expression, and decide to use the corresponding format based on the result.

0reactions
jbenninkcommented, Dec 7, 2022

@odinserj I wondered why cron does not include years for detecting special holidays or special open/closed periods that only exist in that specific year. This relates to cron expression used in Asterisk dialplans where you want to be closed in 2022 on the 10 of October. But the ambiguity with seconds is also something

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Automatic Date/Time parser without specifying format
I am searching for a java library that can parse a string into a POJO without specifying the format. I have researched POjava....
Read more >
Tika Auto Detect Parser
It calls the Parser.parse(InputStream, ContentHandler, Metadata, ParseContext) method with an empty ParseContext. Tika AutoDetectParser Example.
Read more >
Using schema auto-detection | BigQuery
In the Google Cloud console, in the Schema section, for Auto detect, check the Schema and input parameters option. In the bq command-line...
Read more >
How to Auto-Detect the Date/Datetime Columns and Set ...
Say I have a CSV data file that I want to read into a Pandas dataframe, and some of its columns are dates...
Read more >
dateparser – python parser for human readable dates ...
dateparser provides modules to easily parse localized dates in almost any string formats commonly found on web pages. Documentation¶. This documentation is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found