@@ -62,7 +62,7 @@ window.onload = function () {
6262 ui_day_scale : 1 ,
6363 ui_day_positionX : 0 ,
6464 ui_day_positionY : 0 ,
65- ui_date_date : false ,
65+ ui_date_date : "0" ,
6666 ui_date_orientation : false ,
6767 ui_date_year : "2" ,
6868 ui_date_order : "0" ,
@@ -189,7 +189,10 @@ window.onload = function () {
189189 dayFolder . close ( ) ;
190190
191191 const dateFolder = gui . addFolder ( "Date" ) ;
192- dateFolder . add ( options , "ui_date_date" ) . name ( "Date" ) . onChange ( updateMask ) ;
192+ dateFolder . add ( options , "ui_date_date" , optionsToDict ( config . general . properties . ui_date_date . options ) ) . name ( "Date" ) . onChange ( ( ) => {
193+ updateTime ( ) ;
194+ updateMask ( ) ;
195+ } ) ;
193196 dateFolder . add ( options , "ui_date_year" , optionsToDict ( config . general . properties . ui_date_year . options ) ) . name ( "Year" ) . onChange ( updateMask ) ;
194197 dateFolder . add ( options , "ui_date_order" , optionsToDict ( config . general . properties . ui_date_order . options ) ) . name ( "Order" ) . onChange ( updateMask ) ;
195198 dateFolder . add ( options , "ui_date_monthName" ) . name ( "Month Name" ) . onChange ( updateMask ) ;
@@ -335,8 +338,10 @@ window.onload = function () {
335338 properties . ui_day_scale || properties . ui_day_positionx || properties . ui_day_positiony )
336339 updateMask ( ) ;
337340
338- if ( properties . ui_date_date )
341+ if ( properties . ui_date_date ) {
339342 options . ui_date_date = properties . ui_date_date . value ;
343+ updateTime ( ) ;
344+ }
340345 if ( properties . ui_date_orientation )
341346 options . ui_date_orientation = properties . ui_date_orientation . value ;
342347 if ( properties . ui_date_year )
@@ -391,8 +396,11 @@ window.onload = function () {
391396 } , false ) ;
392397
393398 //MARK: Variables
394- let months = [ "January" , "February" , "March" , "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December" ] ,
395- dateDelimiters = [ "" , " " , "-" , "." , "/" ] ;
399+ let months = [
400+ [ "January" , "February" , "March" , "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December" ] ,
401+ [ "Farvardin" , "Ordibehesht" , "Khordad" , "Tir" , "Mordad" , "Shahrivar" , "Mehr" , "Aban" , "Azar" , "Dey" , "Bahman" , "Esfand" ] ,
402+ [ "Muharram" , "Safar" , "Rabi' al-Awwal" , "Rabi' al-Thani" , "Jumada al-Awwal" , "Jumada al-Thani" , "Rajab" , "Sha'ban" , "Ramadan" , "Shawwal" , "Dhu al-Qadah" , "Dhu al-Hijjah" ]
403+ ] , dateDelimiters = [ "" , " " , "-" , "." , "/" ] ;
396404 let days = [ "Sunday" , "Monday" , "Tuesday" , "Wednesday" , "Thursday" , "Friday" , "Saturday" ] ;
397405 let fonts = [ "monospace" , "consolas" , "courier-bold" , "neo-matrix" ] ;
398406 let charsets = [
@@ -464,9 +472,27 @@ window.onload = function () {
464472 function updateTime ( ) {
465473 var today = new Date ( ) ;
466474 today . setHours ( today . getHours ( ) + options . ui_clock_dayLightSaving ) ;
467- year = today . getFullYear ( ) ;
468- month = today . getMonth ( ) ;
469- date = today . getDate ( ) ;
475+
476+ switch ( options . ui_date_date ) {
477+ case "1" :
478+ year = today . getFullYear ( ) ;
479+ month = today . getMonth ( ) + 1 ;
480+ date = today . getDate ( ) ;
481+ break ;
482+ case "2" :
483+ var parts = today . toLocaleDateString ( 'fa-IR-u-nu-latn' ) . split ( "/" ) ;
484+ year = parseInt ( parts [ 0 ] ) ;
485+ month = parseInt ( parts [ 1 ] ) ;
486+ date = parseInt ( parts [ 2 ] ) ;
487+ break ;
488+ case "3" :
489+ var parts = today . toLocaleDateString ( 'ar-SA-u-nu-latn' ) . split ( "/" ) ;
490+ year = parseInt ( parts [ 2 ] ) ;
491+ month = parseInt ( parts [ 1 ] ) ;
492+ date = parseInt ( parts [ 0 ] ) ;
493+ break ;
494+ }
495+
470496 day = today . getDay ( ) ;
471497 hour = today . getHours ( ) ;
472498 minute = today . getMinutes ( ) ;
@@ -543,12 +569,12 @@ window.onload = function () {
543569 }
544570 }
545571
546- if ( options . ui_date_date ) {
572+ if ( options . ui_date_date != "0" ) {
547573 var dateText = date . toString ( ) , monthText , yearText = "" , completeDate ;
548574 if ( dateText . length < 2 )
549575 dateText = "0" + dateText ;
550576 if ( options . ui_date_monthName ) {
551- monthText = months [ month ] ;
577+ monthText = months [ parseInt ( options . ui_date_date ) - 1 ] [ month - 1 ] ;
552578 if ( options . ui_date_allCaps )
553579 monthText = monthText . toUpperCase ( ) ;
554580 } else {
0 commit comments