Go Pro Sign Up Login
0 days 0 hrs 0 min 0 sec

Summer Sale

50% off Level Up Pro until you unsubscribe.
Get access to ALL 128 courses on Level Up Tutorials

This is your last chance to get Level Up Pro for $145/year.

or Learn More
Moon Moon

Buy Now and unlock this series

$

39

.99

$

24

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

File Dates & Titles

In this video, we’ll be learning how to organize files using a new name convention TitleOfFile_DD- MM-YY. That will allow you to sort any file by date and title in a transparent way.

Downloads

Become a pro to download code and videos

Comments

Ryan

about 3 years ago [edited]

In the section of this tutorial where we pull the date out of our file name, you mention wanting to use a start and stop index instead of a start index and length.

If we use String.prototype.substring instead of String.prototype.substr we can accomplish that!

const date = file.substring(
  file.indexOf("_") + 1,
  file.indexOf(".")
);

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring

Want to join the conversation?

Become a Pro member today!