Argon and Carbon comparison

Hello,

It seems that timestamps are saved with the Argon model in OC. Now I took Carbon for my time calculations in my class.

I do this:

if ($now->greaterThan($nowClientDaysPlus)) {
    continue;
}

Where $now is an Carbon instance and $nowClientDaysPlus is an Argon instance and althougth $now is e.g. date: 2023-04-20 14:48:55.422337 UTC (+00:00) and $nowClientDaysPlus is e.g. date: 2023-05-04 06:43:32.0 e (+00:00) the comparison is true.

Do I something wrong or are Argon and Carbon instances unable to compare with greaterThan?

Hey @mathilde

Argon existed mostly to serve requirements that didn’t exist in Carbon. Since Carbon v2, most of the features are available so Argon is becoming redundant. We will probably remove it in the next major release.

AFAIK it shouldn’t have any effect on the comparisons.

1 Like

I don’t know if my the dates should be tourned around in my if-statment. Anyway, for more readability I use now the timestamps:

if ($now->timestamp <= $nowClientDaysPlus->timestamp) {
    continue;
}
1 Like

This looks great, and probably best.