I want to sort object by date.
This is object structure:
const dates = {
3/1/20: 1,
3/10/20: 31,
3/11/20: 35,
3/12/20: 60,
3/13/20: 64,
3/14/20: 70,
3/15/20: 93,
3/16/20: 112,
3/17/20: 112,
3/2/20: 14,
3/3/20: 14,
3/4/20: 16,
3/5/20: 25,
3/6/20: 26,
3/7/20: 29,
3/8/20: 30,
3/9/20: 30
}
The problem is when date starts with number 1 it's listed like: 1, then 11, 12, 13, etc.
I want to be it sorted normaly: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, etc.
The object result I need is:
const dates = {
3/1/20: 1,
3/2/20: 14,
3/3/20: 14,
3/4/20: 16,
3/5/20: 25,
3/6/20: 26,
3/7/20: 29,
3/8/20: 30,
3/9/20: 30,
3/10/20: 31,
3/11/20: 35,
3/12/20: 60,
3/13/20: 64,
3/14/20: 70,
3/15/20: 93,
3/16/20: 112,
3/17/20: 112
}
I have looked at this example, but they are using moment.js which I don't use/don't want to use.
Also I have looked at some answers on this post but this doesn't help me either.