how can I get current solar year local fa (not full date) in react?
I just need to get solar year (jalali) and I'm using this:
new Date().toLocaleDateString('fa-IR');
but it return current date (24/04/1399). I just want (1399)
how can I get current solar year local fa (not full date) in react?
I just need to get solar year (jalali) and I'm using this:
new Date().toLocaleDateString('fa-IR');
but it return current date (24/04/1399). I just want (1399)
You can pass additional options, and transform output as you want
new Date().toLocaleDateString('fa-IR', {year: 'numeric'} );
I find that. the answer is :
new Date().toLocaleDateString("fa-IR", {year: "numeric" });
the above code return 1399. (current jalali year (persian date))
new Date().getFullYear(); // 2020