Skip to content

Instantly share code, notes, and snippets.

@ckoppelman
Last active July 5, 2016 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckoppelman/516dfbb4c7af22f8f980dd6d836031cf to your computer and use it in GitHub Desktop.
Save ckoppelman/516dfbb4c7af22f8f980dd6d836031cf to your computer and use it in GitHub Desktop.
Find the "API version" for an arbitrary Salesforce release name and vice versa.
to_version_string=->v{%w{spring summer winter}[v.to_i%3] + ' ' + (2005+(v.to_i-2)/3).to_s}
from_version_string=->s{
no_apostrophe = s.sub(?', '20')
season, year = no_apostrophe.split(' ')
(2+(year.to_i-2005)*3 + %w{wi sp su}.index(season.downcase[0,2])).to_s + '.0'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment