1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
|
#
#
#
locale ja JP JP
new instance jcal
new gregorian gcal
# Use GMT+09:00 for max day of year test which depends on time zone
# offsets.
timezone GMT+09:00
new instance tokyocal
test Make sure that the maximum year value doesn't depent on era
use jcal
# Note: the max year value is as of Reiwa
assign 292276976 $max
clear all
set date Reiwa 1 May 1
get millis
check max year $max
assign $max $maxyear
clear all
set date Heisei 20 May 5
get millis
check max year $maxyear
clear all
set date Showa 35 May 5
get millis
check max year $maxyear
clear all
set date BeforeMeiji 1 Jun 1
get millis
check max year $max
test Max of ERA
use jcal
# Assumption: Reiwa is the current era
check maximum era Reiwa
check leastmax era Reiwa
test Actual max MONTH
use jcal
clear all
set date BeforeMeiji 1867 Jan 31
check actualmax month Dec
# Make sure that the same value is returned after
# normalization.
get millis
check actualmax month Dec
clear all
set date Meiji 45 Mar 31
check actualmax month Jul
get millis
check actualmax month Jul
clear all
set date Taisho 15 June 1
check actualmax month Dec
get millis
check actualmax month Dec
clear all
set date Showa 64 Jan 4
check actualmax month Jan
get millis
check actualmax month Jan
clear all
set date Heisei 31 Jan 4
check actualmax month Apr
get millis
check actualmax month Apr
clear all
set date Reiwa 2 Jan 1
set year $maxyear
check actualmax month Aug
get millis
check actualmax month Aug
clear all
set date 17 Mar 1
check actualmax month Dec
get millis
check actualmax month Dec
test Actual max DAY_OF_YEAR
use jcal
clear all
set date Meiji 1 Dec 31
# Meiji Gan-nen is a leap year.
check actualmax day_of_year 366
check day_of_year 366
clear all
set date Meiji 45 Jan 1
# Meiji 45 or Taishi Gan-nen is also a leap year.
check actualmax day_of_year 211 # 31+29+31+30+31+30+29
set date Meiji 45 Jul 29
check day_of_year 211
set date Taisho 1 Jul 31
get millis
check actualmax day_of_year 155 # 366 - 211
set date Taisho 1 Dec 31
check day_of_year 155
clear all
set date Taisho 15 Sep 23
check actualmax day_of_year 358 # 365 - 7
set date Taisho 15 Dec 24
check day_of_year 358
set date Showa 1 Dec 25
check actualmax day_of_year 7
set date Showa 1 Dec 31
check day_of_year 7
clear all
set date Showa 64 Jan 3
check actualmax day_of_year 7
set date Showa 64 Jan 7
check day_of_year 7
set date Heisei 1 Aug 9
check actualmax day_of_year 358 # 365 - 7
set date Heisei 1 Dec 31
check day_of_year 358
# time zone dependent
use tokyocal
clear all
set date Reiwa $maxyear Jan 1
# the last date of Reiwa is R292276976.08.17T16:12:55.807+0900
check actualmax day_of_year 229 # 31+28+31+30+31+30+31+17
test Actual max WEEK_OF_YEAR
use jcal
clear all
set date Meiji 1 Jan 1
# Meiji gan-nen is a leap year.
check actualmax week_of_year 52
clear all
set date Meiji 45 Jan 1
check actualmax week_of_year 30
set date Taisho 1 July 31
check actualmax week_of_year 22
clear all
set date Taisho 15 Sep 23
check actualmax week_of_year 51
set date Showa 1 Dec 25
check actualmax week_of_year 1
clear all
set date Showa 64 Jan 3
check actualmax week_of_year 1
set date Heisei 1 Aug 9
check actualmax week_of_year 51
clear all
set date Heisei 31 Apr 28
check actualmax week_of_year 17
set date Reiwa 1 Aug 9
check actualmax week_of_year 35
use tokyocal
set date Reiwa $maxyear Jan 1
# the last date of Reiwa is R292276976.08.17T16:12:55.807+0900 (Sunday)
# The year is equivalent to 2003 (Gregorian).
check actualmax week_of_year 34
test Actual max WEEK_OF_MONTH
use jcal
clear all
set date Meiji 45 Jul 1
check actualmax week_of_month 5
set date Taisho 1 Jul 31
check actualmax week_of_month 5
clear all
set date Taisho 15 Dec 1
check actualmax week_of_month 5
set date Showa 1 Dec 25
check actualmax week_of_month 5
clear all
set date Showa 64 Jan 1
check actualmax week_of_month 5
set date Heisei 1 Jan 8
check actualmax week_of_month 5
clear all
set date Heisei 31 Apr 30
check actualmax week_of_month 5
set date Reiwa 1 May 1
check actualmax week_of_month 5
use tokyocal
set date Reiwa $maxyear Jan 1
# the last date of Reiwa is R292276976.08.17T16:12:55.807+0900 (Sunday)
# The year is equivalent to 2003 (Gregorian).
check actualmax week_of_month 4
test Actual max DAY_OF_WEEK_IN_MONTH
use jcal
clear all
set date Meiji 45 Jul 1
check actualmax week_of_month 5
set date Taisho 1 Jul 31
check actualmax week_of_month 5
clear all
set date Taisho 15 Dec 1
check actualmax week_of_month 5
set date Showa 1 Dec 25
check actualmax week_of_month 5
clear all
set date Showa 64 Jan 1
check actualmax week_of_month 5
set date Heisei 1 Jan 8
check actualmax week_of_month 5
clear all
set date Heisei 31 Apr 30
check actualmax week_of_month 5
set date Reiwa 1 May 1
check actualmax week_of_month 5
use tokyocal
clear all
set date Reiwa $maxyear Jan 1
# the last date of Reiwa is R292276976.08.17T16:12:55.807+0900 (Sunday)
# The year is equivalent to 2003 (Gregorian).
check actualmax week_of_month 4
test Actual max YEAR
use jcal
clear all
set date BeforeMeiji 1 Jan 1
check actualmax year 1867
set date Meiji 1 Jan 1
check actualmax year 45
set date Meiji 1 Jul 30
check actualmax year 44
set date Taisho 1 Jul 30
check actualmax year 15
set date Taisho 1 Dec 25
check actualmax year 14
set date Showa 2 Jan 1
check actualmax year 64
set date Showa 1 Dec 25
check actualmax year 63
set date Heisei 1 Jan 7
check actualmax year 64
set date Heisei 1 Aug 18
check actualmax year 30
set date Reiwa 1 Apr 30
check actualmax year 31
# Date/time beyond the last date in the max year.
set date Reiwa 1 Aug 18
check actualmax year 292276975
test Least max YEAR
set date Heisei 17 Mar 1
# Taisho is the shortest era, 14 years.
# (See above actual max YEAR case.)
check leastmax year 14
test Acutual min YEAR
# Get minimum values for comparison
clear all
set era BeforeMeiji
get min year
assign $result $minyear
set date $minyear Dec 31
eval $minyear + 1
assign $result $minyear_plus_one
# BeforeMeiji 1 Dec 31 should exist in the minimum year which
# should be the same value as the getMinimum() value.
set date BeforeMeiji 1 Dec 31
check actualmin year $minyear
# Jan 1 shouldn't exist in the same year. So the actual minimum is
# $minyear + 1.
set date 1 Jan 1
check actualmin year $minyear_plus_one
# 1 should be returned if it's on a date of the last
# year which also exists in the first year of each era.
clear all
set date Meiji 45 Jan 1
check actualmin year 1
clear all
set date Taisho 14 Jul 30
check actualmin year 1
clear all
set date Showa 60 Dec 25
check actualmin year 1
clear all
set date Heisei 17 Jan 8
check actualmin year 1
# 2 should be returned if it's on a date of the last year which
# doesn't exist in the first year of each era. (Meiji is an
# exception.)
clear all
set date Taisho 14 Jul 29
check actualmin year 2
clear all
set date Showa 60 Dec 23
check actualmin year 2
clear all
set date Heisei 17 Jan 7
check actualmin year 2
|