mde / timezone-js

DEPRECATED: Timezone-enabled JavaScript Date object. Uses Olson zoneinfo files for timezone data.
824 stars 183 forks source link

New date formattig algorithm #176

Open stswoon opened 8 years ago

stswoon commented 8 years ago

Add ability to format date like in Java 1) date literals z, Z, X 2) escaping 3) strict mode for non date literals outside escape block By default new formatting is disabled to save compatibility. To enable it call timezoneJS.timezone.init({newFormatting:{enabled:true}})

stswoon commented 8 years ago

Hello MDE.

Thank you for your timezone-js project. You has done a great job. Your product helped me in my projects. Unfortunaly I noticed that tzDate have a little issue with formatting and parsing date, e.g. it can't format date with +XX:XX, also it can't escape symbols. Formatting was critical for my project so I done it around your code (proxy function). Now I decided to improve your project (of course if you allow me to do it). I tried to do formatting like in Java as much closer as I can. But there are some assumtions because of data in Olson time zone files. All assumptions you can find in comments in code. For more information you also can see https://github.com/stswoon/tz. There is my experiments with js and java code.

I hope my improvement will be usefull for you. Best Regards, Anatoly Nekhozhin.