Change default sketch_MMMDDx names to sketch_YYYYMMDDx

I dislike the sketch_MMMDDx names. They do not sort chronologically--April comes before January, December before November, and they have no year. If you've left them around for more than a year, they clash with each other.

sketch_apr03a	sketch_apr24a	sketch_dec20b	sketch_feb09a	sketch_feb23b	sketch_jan21a	sketch_mar08b	sketch_mar27b	sketch_nov18a
sketch_apr06a	sketch_apr25a	sketch_dec21a	sketch_feb09b	sketch_feb23c	sketch_jan22a	sketch_mar09a	sketch_mar27c	sketch_nov24a
sketch_apr07a	sketch_apr27a	sketch_dec28a	sketch_feb10a	sketch_feb24a	sketch_jan23a	sketch_mar12a	sketch_mar28b	sketch_nov24b
sketch_apr12a	sketch_dec05a	sketch_dec29a	sketch_feb14a	sketch_feb26a	sketch_jan23c	sketch_mar12b	sketch_mar28c	sketch_nov25a
sketch_apr13a	sketch_dec07a	sketch_feb01a	sketch_feb16a	sketch_feb28b	sketch_jan23d	sketch_mar16a	sketch_mar29a	sketch_oct22a
sketch_apr14a	sketch_dec10a	sketch_feb01b	sketch_feb16b	sketch_feb28c	sketch_jan24a	sketch_mar18a	sketch_mar30a	sketch_sep12b
sketch_apr15a	sketch_dec17a	sketch_feb01c	sketch_feb19a	sketch_jan02a	sketch_jan29a	sketch_mar18b	sketch_may02a	sketch_sep12c
sketch_apr16a	sketch_dec18a	sketch_feb01d	sketch_feb21a	sketch_jan03a	sketch_jan31a	sketch_mar20a	sketch_may02b
sketch_apr19a	sketch_dec18b	sketch_feb03a	sketch_feb21b	sketch_jan09a	sketch_mar05a	sketch_mar21a	sketch_may02c
sketch_apr21a	sketch_dec18c	sketch_feb03b	sketch_feb22a	sketch_jan11b	sketch_mar05b	sketch_mar25a	sketch_may03a
sketch_apr23a	sketch_dec20a	sketch_feb07a	sketch_feb23a	sketch_jan13a	sketch_mar08a	sketch_mar26a	sketch_nov07a

Is there a way to change the template names to something more sane?

at least day has leading zeros. it could be worse
maybe it is willfully, so people rename it meaningful

1 Like

I believe system date setting is used... non?

no. leading Month is not option of my system.
maybe in IDE 2.x ?

1 Like

The OS will allow this setting to be changed. MMMDDYYYY is the USoA default.

yes, i changed DDD MM yyyy to YYYY-MM-DD and my ide 1.8.x show no difference

1 Like

Strange that a European author wrote that. I set my systems for yyyymmmdd.

The code that defines the default sketch name in the Arduino IDE 2.x codebase is here:

I'm a staunch supporter of using the ISO 8601-compliant date format, but I don't see that it is an issue here because nobody should be using the default name for any sketch they care about. The default name only has to be something unique and the current name format is sufficient for that purpose, even if ugly.

3 Likes

It's not an issue because nobody should be using it?

I don't see how that code zero-pads days, but maybe this would pad months the same way:

const sketchBaseName =`sketch_${today.getYear()}${today.getMonth()+1}${today.getDate()}`;

Or at the least, this would sort chronologically and encourage more renaming:

const sketchBaseName = `sketch_`;

In order to make all relevant information available to any who are interested in this subject, I'll add a link to the formal report @DaveX submitted to the issue tracker on GitHub:

1 Like

I see that if you click File/SaveAs, the default generated name adds an ISO-time stamp like:

sketch_jan23a_copy_20230516140139

So one awkward workaround is to always save a copy, and delete the middle bit:

sketch_20230516140139

Wow just wow.
That seems to be taking a lazy mindset.
Granted it isn't a bug or functional issue but lots of things in s/w including the Arduino IDE are done for esthetics and convenience vs pure functionality.

--- bill

I'm not sure whether this bit o' design is esthetics or functionality:

I think most would agree that the current auto generate name format isn't for esthetics.
The current format also doesn't provide the functionality for sorting
AND despite @ptillisch comment, the current format doesn't even provide guaranteed uniqueness given there is no year.

I bump into these types of file naming/format issues all over the place.
It isn't unique to Arduino s/w. It even affects the names of reports in financial statements in the financial industry. i.e. lots of cases where people's electronic financial statements are not sortable because they used a format that has month names in it.

IMO, it comes from a mindset of the developers/implementers not taking sorting into consideration when they picked a format, then later when the sorting issue is pointed out either not valuing sorting, because they themselves don't ever use the capability, or are too lazy to want to make a change.

sketch_MMMDDx was a silly (IMO dumb) choice from the outset for a variety of reasons.
Something that includes ISO8601 formats like these would have been better.

sketch_YYYY-MM-DD-hh:mm:ss
sketch_YYYY-MM_DD-n
(where n is a numeric instance)

And on save as they could have put the ISO stuff at the front of the name instead of the back to provide sorting capability.

OR they could have just totally copped out completely and simply required the user to enter a name rather than try to automatically generate one.
I actually think not auto generating a name at all and simply requiring user input would have been better than the goofy auto generated name that is currently being used.

1 Like

Agree. Except I don't mind a prefix to sort the autogenerated names together. I often use a forum_ prefix for junk code pasted from here.

It does indeed guarantee uniqueness via the letter suffix:

Ah. Ok. I stand corrected. Obviously I failed to think that through.
Thank you for pointing that out.

Still, the names could be more friendly to sorting.
Or just don't have the IDE auto generate a name and force the user to specify his own name since as you said:

because nobody should be using the default name for any sketch they care about.

--- bill

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.