nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: bradymholt/cRonstrue
Pull request #292 (2023-08-14 14:31:33)

If string has a range in first interval don't render "de"
This pull request addresses an issue where double occurrences of "de" were introduced during the conversion of certain cron expressions to text in the pt_BR locale. The proposed changes ensure that the double "de" is prevented, specifically when a range is present at the beginning of the string.

| expression | response | expected |
| ---- | --------- | ---------- |
| * * * 1-4,7 | somente de de segunda-feira a sexta-feira e domingo | somente de segunda-feira a sexta-feira e domingo|
| * * * 1-4,6 * | a cada dia, somente em de janeiro a abril e junho | a cada dia, somente de janeiro a abril e junho |

bradymholt: Thanks!

Patch:
diff --git a/src/i18n/locales/pt_BR.ts b/src/i18n/locales/pt_BR.ts
index 3ac0cc1..3926ef3 100644
--- a/src/i18n/locales/pt_BR.ts
+++ b/src/i18n/locales/pt_BR.ts
@@ -56,11 +56,11 @@ export class pt_BR implements Locale {
   commaOnDayX0OfTheMonth() {
     return ", no dia %s do mês";
   }
-  commaOnlyInX0() {
-    return ", somente em %s";
+  commaOnlyInX0(s?: string) {
+    return s && s.length > 1 && s[1] === "-" ? "somente %s" : ", somente em %s";
   }
-  commaOnlyOnX0() {
-    return ", somente de %s";
+  commaOnlyOnX0(s?: string) {
+    return s && s.length > 1 && s[1] === "-" ? ", somente %s" : ", somente de %s";
   }
   commaAndOnX0() {
     return ", e de %s";


Test patch:
diff --git a/test/i18n.ts b/test/i18n.ts
index c55b831..8d1b1fd 100644
--- a/test/i18n.ts
+++ b/test/i18n.ts
@@ -156,7 +156,6 @@ describe("i18n", function () {
       );
     });
   });
-
   describe("pt_BR", function () {
     it("* * * * *", function () {
       assert.equal(cronstrue.toString(this.test?.title as string, { locale: "pt_BR" }), "A cada minuto");
@@ -168,8 +167,16 @@ describe("i18n", function () {
         "A cada 5 minutos, entre 03:00 PM e 03:59 PM, de segunda-feira a sexta-feira"
       );
     });
+
+    it("*/5 15 * * MON-FRI,SUN", function () {
+      assert.equal(
+        cronstrue.toString(this.test?.title as string, { locale: "pt_BR" }),
+        "A cada 5 minutos, entre 03:00 PM e 03:59 PM, somente de segunda-feira a sexta-feira e domingo"
+      );
+    });
   });
 
+
   describe("pt_PT", function () {
     it("* * * * *", function () {
       assert.equal(cronstrue.toString(this.test?.title as string, { locale: "pt_PT" }), "A cada minuto");
Repository: bradymholt/cRonstrue
Pull request #310 (2023-11-16 23:34:42)

Specify "cron" in error message
Fixes https://github.com/bradymholt/cRonstrue/issues/309


Patch:
diff --git a/src/cronParser.ts b/src/cronParser.ts
index 0dbe6ea..d7cb589 100644
--- a/src/cronParser.ts
+++ b/src/cronParser.ts
@@ -34,7 +34,7 @@ export class CronParser {
 
   protected extractParts(expression: string) {
     if (!this.expression) {
-      throw new Error("Expression is empty");
+      throw new Error("cron expression is empty");
     }
 
     // split on one or more spaces


Test patch:
diff --git a/test/cronstrue.ts b/test/cronstrue.ts
index ba949bb..b44670d 100644
--- a/test/cronstrue.ts
+++ b/test/cronstrue.ts
@@ -702,19 +702,19 @@ describe("Cronstrue", function () {
     it("empty expression", function () {
       assert.throws(function () {
         cronstrue.toString("");
-      }, "Error: Expression is empty");
+      }, "Error: cron expression is empty");
     });
 
     it("null expression", function () {
       assert.throws(function () {
         cronstrue.toString(null as any as string);
-      }, "Error: Expression is empty");
+      }, "Error: cron expression is empty");
     });
 
     it("undefined expression", function () {
       assert.throws(function () {
         cronstrue.toString("");
-      }, "Error: Expression is empty");
+      }, "Error: cron expression is empty");
     });
 
     it("'W' list is invalid", function () {
Repository: bradymholt/cRonstrue
Pull request #344 (2025-04-04 06:08:25)

Avoid pluralized weekdays on danish translation
This fizes #329 

bradymholt: Thanks @rmja - I appreciate it!

Patch:
diff --git a/src/i18n/locales/da.ts b/src/i18n/locales/da.ts
index 2590d66..b16a748 100644
--- a/src/i18n/locales/da.ts
+++ b/src/i18n/locales/da.ts
@@ -50,8 +50,8 @@ export class da implements Locale {
   commaOnlyInX0() {
     return ", kun i %s";
   }
-  commaOnlyOnX0() {
-    return ", på %se";
+  commaOnlyOnX0(s?: string) {
+    return ", på enhver %s";
   }
   commaAndOnX0() {
     return ", og på %s";


Test patch:
diff --git a/test/i18n.ts b/test/i18n.ts
index d53cdeb..eac2b7a 100644
--- a/test/i18n.ts
+++ b/test/i18n.ts
@@ -1,6 +1,7 @@
 import "mocha";
-import { assert } from "chai";
 import cronstrue from "../src/cronstrue-i18n";
+import chai = require("chai");
+let assert = chai.assert;
 
 describe("i18n", function () {
   describe("de", function () {
@@ -345,7 +346,14 @@ describe("i18n", function () {
     it("0 3 * * 4", function () {
       assert.equal(
         cronstrue.toString(this.test?.title as string, { locale: "da" }),
-        "Kl 03:00, på torsdage"
+        "Kl 03:00, på enhver torsdag"
+      );
+    });
+
+    it("0 3 * * 4,5", function () {
+      assert.equal(
+        cronstrue.toString(this.test?.title as string, { locale: "da" }),
+        "Kl 03:00, på enhver torsdag og fredag"
       );
     });
   });