JavaScript��Date���֥������Ȥ�date.setMonth(-1)�Ȥ��ȡ���ǯ��12��ˤ��Ƥ�������������ʤΤǤ�����Safari�Ǿ�꤯ư���ʤ��ä��ꤹ��褦�ʤΤ�prototype��ñ¤¤ï¿½ï¿½Ð½è¤·ï¿½Æ¤ß¤Þ¤ï¿½ï¿½ï¿½ï¿½ï¿½
�ʤˤ������ͤˤ��Ƥ��餬�����Ǥ��롣
Core JavaScript 1.5 Reference:Global Objects:Date:setMonth - MDC
- monthValue
- An integer between 0 and 11 (representing the months January through December).
- dayValue
- An integer from 1 to 31, representing the day of the month.
�Τ��ˡ�
If a parameter you specify is outside of the expected range, setMonth attempts to update the date information in the Date object accordingly. For example, if you use 15 for monthValue, the year will be incremented by 1 (year + 1), and 3 will be used for month.
�ȡ�> 11�ξ��ξ��Ͻ񤤤Ƥ��äƤ⡢< 0 �ξ��Ͻ񤤤Ƥʤ���
�ºݡ��ְ�����פ�������Ƥ��ޤ��ȡ����������꤬ȯ����������äƤ���Τ���
404 Blog Not Found:����31���ΰ��������?��������������ܽ����Entry�Υ����ȥ�ˤ������Ƥ���ʤ��ΤǤ��롣���������Ȥ����Τ�¸�ߤ��ʤ�������Ǥ������Ȭ���ʤ����󽽶������դ��路���Τ���30�����ʤΤ���31�����ʤΤ���
�ʲ����Ƽ�¸���
�Ȥˤ������ְ�����פȤ����Τϡ��Х����ڤ�ΤƤʤ����������Ȼפ��������Javascript�˸¤ä��äǤϤʤ���
Dan the Man with Too Many Dates Forgotten
ECMAScript �Ǥϡ�ǯ����������Ȥ��� Epoch �����������׻����������ؿ� MakeDay(year, month, date) ���������Ƥ��� (ECMA-262 3rd 15.9.1.12)��setMonth �⤳������Ѥ��Ƥ��ޤ��� (Ʊ 15.9.5.38)��������� yaer = year + floor(month / 12), month = month modulo 12 �Ȥ��ä����������������Ԥ��Ƥ��ޤ���
�Ǥ��Τǡ�������Ϥ����Ȥ��Ƥâ¤ï¿½ï¿½ï¿½ï¿½È½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ì¡¢ï¿½ï¿½ï¿½Í½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ì¤¿ï¿½È¤ï¿½ï¿½ï¿½Î·ï¿½Ì¤ï¿½ï¿½Ö¤Ã¤Æ¤ï¿½ï¿½ï¿½Ï¤ï¿½ï¿½Ç¤ï¿½ (���줬�����̤꤫�Ϥ��Ƥ�����)��
�ʤ���floor��modulo �� ECMA-262 3rd 5.2 �������Ƥ��ޤ�������������ˤ��� -1 modulo 12 �� 11 ���֤��ޤ���